help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binary image from a plot


From: Maria Jose Casas Serrano
Subject: Re: Binary image from a plot
Date: Fri, 10 Jul 2020 14:06:52 +0200

HI Nicklas, 

I use print instead of saveas when saving the plot but as far as I know they are very similar, aren’t they?: 
# save as png monochrome
print(plothandler, filenameimage, "-mono);

And when reading the image I’m using imread but the image has grayscale color type and I should convert it to binary for the fitness function. Finally I got it but at the moment I sent the first email I was a bit stuck on this.

Thanks for you tip too ;)

Regards

Maria 


On 10 Jul 2020, at 13:41, N <nicklas.karlsson17@gmail.com> wrote:

Hi Przemek,

My goal is to compare the images to see their similarities. I’m modelling an evolutionary process and the fitness function needs to receive the binary matrix of the images, then it calculates the coincidence of their values (1 for background and 0 for foreground). Perhaps it sounds like I'm “re-inventing the wheel"… but I found some way to do it without losing much time.

Thanks for your tip and your time.

Regards,

Maria

You use saveas(...) function to save picture and imread(...) function to read the image into a matrix or similar.

You create figure with:
 h = figure;
So that you have a handle for the saveas(...) function. Also remember to chose format and add filename ending into filename. Suitable format is png for lossless compression or jpg which lose some information, typically high frequency sharp edges in case file size is important. To read file into matrix, may return several parameters:
 saveas(h, ...)
 [...] = imread(filename)

If in doubt about syntax:
 help saveas
 help imread

Then you have data for in the returned parameters you compare for their similarities but what kind of measure you have for similarities I have no idea.


Remember reading about evolutionary algorithms at spring time then it was nice weather, sitting inside programming generations of evolutionary algorithms.

Regards Nicklas Karlsson


reply via email to

[Prev in Thread] Current Thread [Next in Thread]