I need to have a few hundred photos manually inspected and edited. Certain things need to be blacken out, while others marked in various ways.
I would like to write a script/GUI that will allow me to do the following:
1) Open mspaint
2) load image (uint8 matrix) currently saved in workspace into open session
3) when done editing, close mspaint and save new image into workspace (as uint8 matrix)
to implement this, I wish to know:
How to load an image from workspace into an open mspaint session.
How to save an image from a mspaint session to workspace as uint8 matrix.
How to close mspaint - openning is with "system('mspaint')"
Help would be much appriciated.
Thanks, Alon
MSPaint doesn't have an API, however, you can pass a filename to it as a command line argument.
The downside to this approach is that the user is responsible for saving the image back to the same location and exiting MSPaint after editing the image.
function im = edit_in_paint(im)
temp_filename = [tempname, '.png'];
imwrite(im, temp_filename);
system(['mspaint.exe ' temp_filename]);
im = imread(temp_filename);
delete(temp_filename)
Example
>> im = imread('rice.png');
>> im = edit_in_paint(im);
(MSPaint opens)

Edit image, then save (Ctrl+s) and exit to return to MATLAB
>> imshow(im);

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With