
plotting pixel values on a 256x256 image when only some pixel co-ordinates are known, and the unknowns can be 0 or NaN
1 回表示 (過去 30 日間)
古いコメントを表示
I have the indices (x,y co-ordinates) and pixel values i want to visualise on a 256x256 image (i don't have all the pixel co-ordinates, so the "missing pixels" I just want displayed as 0 or Na
my data is uploaded and is 3 columns X co-ordinate, Y coordinate and pixel value in the 3rd column
sorry stupid question but how do I do this?
thanks
0 件のコメント
採用された回答
Image Analyst
2018 年 8 月 7 日
This works:
s = load('XYpixelvalue.mat')
x = int32(s.dataXYZ(:, 1));
y = int32(s.dataXYZ(:, 2));
grayLevels = uint8(s.dataXYZ(:, 1));
grayImage = zeros(max(y), max(x), 'uint8');
for k = 1 : length(x);
grayImage(y(k), x(k)) = grayLevels(k);
end
imshow(grayImage);
axis('on', 'image');

3 件のコメント
Image Analyst
2018 年 8 月 7 日
The original pixel values are in the range 1-255, NOT 1-6. Check your mat file again. You can leave them as double if you want, but you'll have to use [] in imshow() to see them and you'll have to set up a colormap if you want that to be an indexed image.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!