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

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

 Accepted Answer

ditehen jewhan
ditehen jewhan on 4 Apr 2023

0 votes

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

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!