Help with reading the RGB value of every pixel of a truecolor image using impixel
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have a 16bit tiff that I want to get the RGB value from each pixel in the image. The image is a 3840x2160 16bit tiff. So, I ran the impixel command:
I= imread('sample.tif');
c = [1:3840,];
r = [1:2160,];
impixel(I,c,r)
but I get this error:
Error using impixel>parse_inputs (line 257)
Xi and Yi must have the same length.
Error in impixel (line 76)
[a,cm,xi,yi,x,y] = parse_inputs(varargin{:});
Error in pixel_get (line 4)
impixel(I,c,r)
Am I doing something wrong with the syntax for column or range? Or do you suggest doing this a different way?
Thanks
0 件のコメント
採用された回答
Veda Upadhye
2017 年 11 月 14 日
Hi,
The error indicates that the vectors 'c' and 'r' should have the same length.
According to the documentation of impixel (https://www.mathworks.com/help/images/ref/impixel.html),
"impixel(I,c,r) returns the values of pixels specified by the row and column vectors r and c. r and c must be equal-length vectors. The kth row of P contains the RGB values for the pixel (r(k),c(k))."
For example, the following modification in your code would work.
I= imread('sample.tif');
c = [1:2160];
r = [1:2160];
impixel(I,c,r)
Hope this helped!
-Veda
その他の回答 (1 件)
Chris Loizou
2017 年 11 月 13 日
Hello,
yes well you are doing something wrong with sintax. Remove the comma from the brackets
if true
I= imread('sample.tif');
c = [1:3840];
r = [1:2160];
impixel(I,c,r)
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!