数据类型问题,累加到255就不增长了。

我用断点看了,这个gray变量增加到255就不变了,这是为什么呢?应该是数据类型的原因感觉matlab好多莫名其妙的问题!!!!!一点不友好:'(

 Respuesta aceptada

ditehen jewhan
ditehen jewhan el 4 de Abr. de 2023

0 votos

gray的数据类型直接由加数的类型决定,因为im2gray结果的数据类型是uint8,所以A(i,j)以及gray都是uint8类型。建议加一步转换数据类型的步骤,x=int16(A(i,j));gray=gray+x;

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 4 de Abr. de 2023

Respondida:

el 4 de Abr. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by