フィルターのクリア

how can i save matrix of image in matlab to get this pixels on a file.h to use it by code composer studio ?

1 回表示 (過去 30 日間)
hello,
* *how can i save matrix of image in matlab to get this pixels on a file.h to use it by code composer studio ?** thanks

回答 (1 件)

Image Analyst
Image Analyst 2016 年 2 月 24 日
Perhaps use fprintf() to print out all the pixel values.
  2 件のコメント
Image Analyst
Image Analyst 2016 年 2 月 25 日
Souhir's "Answer" moved here"
I try this code:
rgbImage = imread('peppers.png');
[rows, columns, numberOfColorChannels] = size(rgbImage)
fid = fopen('deleteme.txt', 'wt');
for col = 1 : columns
for row = 1 : rows
fprintf(fid, '%d, %d = (%d, %d, %d)\n', ...
row, col, ...
rgbImage(row, col, 1),...
rgbImage(row, col, 2),...
rgbImage(row, col, 3));
end
end
But i work with an image in gray scale, i want to get pixels seppared by commas in a file, i think that this code is very near but i don't found solution, can anyone help me please
Image Analyst
Image Analyst 2016 年 2 月 25 日
Try this
grayImage = imread('cameraman.tif');
fid = fopen('deleteme.txt', 'wt');
fprintf('%d, ', grayImage);
fclose(fid);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by