Filter löschen
Filter löschen

how to resolve this code

2 Ansichten (letzte 30 Tage)
Poonam
Poonam am 15 Mär. 2015
Kommentiert: Image Analyst am 15 Mär. 2015
figure;imshow(Ims);
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'k', 'LineWidth', 2)
end
I want the image in the figure to be save as png file via code,not by using save as option from figure
have used saveas but it print entire figur in png format,iwant the image of original sized to be saved
  1 Kommentar
Poonam
Poonam am 15 Mär. 2015
Is there nobody to answer this

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 15 Mär. 2015
Bearbeitet: Image Analyst am 15 Mär. 2015
Write to the image instead of plotting over it in the overlay :
imshow(Ims);
hold on
for k = 1:length(B)
thisBoundary = B{k};
rows = thisBoundary(:, 1);
columns = thisBoundary(:, 2);
for p = 1 : length(rows)
thisRow = rows(p);
thisColumn = columns(p);
Ims(thisRow, thisColumn, :) = uint8([0, 0, 0]);
end
end
imshow(Ims);
drawnow;
imwrite(Ims, filename);
If you want thicker lines, you'll have to write in a region around thisRow, thisColumn instead of just doing the single pixel.
  2 Kommentare
Poonam
Poonam am 15 Mär. 2015
I want to save this figure result to its original size of image in file,there should be no white margin around it, as when done saveas,print it gives white margin,i want it to be saved in its original size as it is done using imwrite to save image in file
Image Analyst
Image Analyst am 15 Mär. 2015
That's what it does. imwrite() does not add any extra stuff around it like hgsave(), export_fig(), saveas(), etc.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by