Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Image decomposition in matrix

Subject: Image decomposition in matrix

From: Pierrot

Date: 16 Oct, 2012 09:10:08

Message: 1 of 3

Hello, I m trying to analyse an Indexed image by replacing the value > 0 by 1 and the other by 0 in a matrix but I cant find out how to combine the "find" results into a new matrix (here MAT0 and MAT1). The size of the matrix is 240*240.

Here is the beginning of my code :
imgw='C:\Projects\img.png';
RGB = imread(imgw,'PNG');
[IND,map] = rgb2ind(RGB,32);

% New Matrix 240*240 empty = 0
MAT0 = zeros(240);
MAT1 = zeros(240);

% Find indices and values of zero elements
MAT0 = find(IND(:,:,1)==0)

% Find indices and values of nonzero elements
MAT1 = find(IND(:,:,1)>0)


Thank you for your help!

Subject: Image decomposition in matrix

From: ensiyeh64@gmail.com

Date: 23 Jun, 2013 05:37:02

Message: 2 of 3

On Tuesday, October 16, 2012 12:40:09 PM UTC+3:30, Pierrot wrote:
> Hello, I m trying to analyse an Indexed image by replacing the value > 0 by 1 and the other by 0 in a matrix but I cant find out how to combine the "find" results into a new matrix (here MAT0 and MAT1). The size of the matrix is 240*240.
>
>
>
> Here is the beginning of my code :
>
> imgw='C:\Projects\img.png';
>
> RGB = imread(imgw,'PNG');
>
> [IND,map] = rgb2ind(RGB,32);
>
>
>
> % New Matrix 240*240 empty = 0
>
> MAT0 = zeros(240);
>
> MAT1 = zeros(240);
>
>
>
> % Find indices and values of zero elements
>
> MAT0 = find(IND(:,:,1)==0)
>
>
>
> % Find indices and values of nonzero elements
>
> MAT1 = find(IND(:,:,1)>0)
>
>
>
>
>
> Thank you for your help!

hello

I am request help for writing the cell decomposition algorithm code in matlan and respite is four day.

tanks

Subject: Image decomposition in matrix

From: dpb

Date: 23 Jun, 2013 16:29:37

Message: 3 of 3

On 6/23/2013 12:37 AM, ensiyeh64@gmail.com wrote:
> On Tuesday, October 16, 2012 12:40:09 PM UTC+3:30, Pierrot wrote:
>> Hello, I m trying to analyse an Indexed image by replacing the
>> value 0 by 1 and the other by 0 in a matrix but I cant find out how
>> to combine the "find" results into a new matrix (here MAT0 and
>> MAT1). The size ofthe matrix is 240*240.
>>
>>
>>
...

>> [IND,map] = rgb2ind(RGB,32);
>> % New Matrix 240*240 empty = 0
>> MAT0 = zeros(240);
>> MAT1 = zeros(240);
>>
>> % Find indices and values of zero elements
>>
>> MAT0 = find(IND(:,:,1)==0)
>>
>>
>>
>> % Find indices and values of nonzero elements
>>
>> MAT1 = find(IND(:,:,1)>0)
...

You can actually dispense w/ FIND for this operation and use the logical
addressing directly...

IND(IND(:,:,1)>0)=1;

etc., ...


> I am request help for writing the cell decomposition algorithm code
> in matlan and respite is four day.
...

This just showed up in newsreader; suspect it's a branch that has
nothing to do w/ original which may have been answered before, anyways,
but what the heck, it's a slow morning... :)

If it's a plea for help on a languishing posting as I suspect, starting
a new thread w/ a clearer exposition of the problem and a specific
Matlab question would likely engender better response...

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us