[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Binary image from a plot
From: |
N |
Subject: |
Re: Binary image from a plot |
Date: |
Fri, 10 Jul 2020 13:41:17 +0200 |
> 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