Thread Subject: range in matlab

Subject: range in matlab

From: islinaismail@gmail.com

Date: 12 Apr, 2009 14:33:00

Message: 1 of 9

Hye...everyone...
Let say if i need to specify the value of x must be between 0.8y and
y...How should i write the codes in matlab(to show the range)?
plz help me...
thanks..

Subject: range in matlab

From: Nasser Abbasi

Date: 12 Apr, 2009 15:32:21

Message: 2 of 9


<islinaismail@gmail.com> wrote in message
news:3176421a-91ed-43bd-b87e-36056c2fd55d@y10g2000prc.googlegroups.com...
> Hye...everyone...
> Let say if i need to specify the value of x must be between 0.8y and
> y...How should i write the codes in matlab(to show the range)?
> plz help me...
> thanks..

What is the context? Give an example of how you want to use this.

Matlab has no subtypes of this sort, but you could always create your own
restricted types using by defining a class, since a class is basically a
user defined type where you can set the range of values and the operations
on the type yourself.

--Nasser

Subject: range in matlab

From: islinaismail@gmail.com

Date: 12 Apr, 2009 16:10:32

Message: 3 of 9

Actually,i want to compare 2 images and detect the originality of the
fabric based on its fourier spectrum through fft process.If the 2
images got the same fourier spectrum,the system will match and detect
it as original and vice versa..But,how about if there are only 10%
differences of its fourier spectrum between this 2 images...?How can i
match this 2 images and detect it as original in this range(such as
image2 got 90% same of its fourier spectrum compare to the image1)Here
are the piece of codes:


% Fourier spectrum for image1

image1 = fd; % image signal
F=fft2(image1, 256,256); %create finer sampling using DFT
F1=fftshift(F); %display in center
axes(handles.axes11);%show fourier spectrum
imshow(log(1+abs(F1)),[]); %brighten the display(min value=black,max
value=white)


% Fourier spectrum for image2

image2 = fr; % image signal
F=fft2(image2, 256,256); %create finer sampling using DFT
F2=fftshift(F); %display in center
axes(handles.axes12);%show fourier spectrum
imshow(log(1+abs(F2)),[]); %brighten the display(min value=black,max
value=white)



%result
value1 = F1;
value2 = F2;

if (value1 == value2)
   message=strcat('The fabric examined is an ORIGINAL fabric jersey
cloth');
   msgbox(message);

elseif (value2 <= 0.8*value1) % i had stucked on this algorithm
   message=strcat('The fabric examined is an ORIGINAL fabric jersey
cloth');
   msgbox(message);

else
   message=strcat('The fabric examined is a FAKE fabric jersey
cloth');
   msgbox(message);
end


plz help me....really need your help..thanks...
=(

Subject: range in matlab

From: Matt Fig

Date: 12 Apr, 2009 16:19:01

Message: 4 of 9

y = 111; % .8*y=88.8
r = .8*y + (y-.8*y).*rand(10,1)

Subject: range in matlab

From: islinaismail@gmail.com

Date: 12 Apr, 2009 16:31:25

Message: 5 of 9

On Apr 12, 3:19=A0pm, "Matt Fig" <spama...@yahoo.com> wrote:
> y =3D 111; =A0% .8*y=3D88.8
> r =3D .8*y + (y-.8*y).*rand(10,1)

Thanks for the help..But,can u plz explain it briefly...since i am
just the beginner in Matlab.Thanks...

Subject: range in matlab

From: Nasser Abbasi

Date: 12 Apr, 2009 16:42:49

Message: 6 of 9


<islinaismail@gmail.com> wrote in message
news:bfc27679-5ad5-4be0-9d14-a523a8d574e1@a5g2000pre.googlegroups.com...
> Actually,i want to compare 2 images
<snip>
>

I am no imaging expert, but may be you could just do it in spatial domain
and compare the 2 images based on relative error or absolute error or
histogram difference or RMSE or peak SNR?

Either way, if you use spectrums, can you just find say the relative error
between the 2 spectrums and check that for the tolerance you want?

--Nasser

Subject: range in matlab

From: islinaismail@gmail.com

Date: 12 Apr, 2009 17:26:38

Message: 7 of 9


>
> Either way, if you use spectrums, can you just find say the relative error
> between the 2 spectrums and check that for the tolerance you want?
>
> --Nasser

How to calculate the relative error between 2 images?plz help me....

Subject: range in matlab

From: Nasser Abbasi

Date: 12 Apr, 2009 19:17:24

Message: 8 of 9


<islinaismail@gmail.com> wrote in message
news:35af8249-af09-499f-8d9e-8cf554a6d520@x1g2000prh.googlegroups.com...
>
>>
>> Either way, if you use spectrums, can you just find say the relative
>> error
>> between the 2 spectrums and check that for the tolerance you want?
>>
>> --Nasser
>
> How to calculate the relative error between 2 images?plz help me....

(Better to divide by original image, not the new_image ......Here it is
again)

relative_error = abs( original_image - new_image)/original_image

(you can multiply by 100 to make it percentage if you like).

Division is done element by element. (since images are 2D matrices).

Then you could take the mean of the resulting relative_error image to obtain
one single numerical value.

--Nasser

Subject: range in matlab

From: islinaismail@gmail.com

Date: 12 Apr, 2009 20:23:35

Message: 9 of 9

On Apr 12, 6:17=A0pm, "Nasser Abbasi" <n...@12000.org> wrote:
> <islinaism...@gmail.com> wrote in message
>
> news:35af8249-af09-499f-8d9e-8cf554a6d520@x1g2000prh.googlegroups.com...
>
>
>
> >> Either way, if you use spectrums, can you just find say the relative
> >> error
> >> between the 2 spectrums and check that for the tolerance you want?
>
> >> --Nasser
>
> > How to calculate the relative error between 2 images?plz help me....
>
> (Better to divide by original image, not the new_image ......Here it is
> again)
>
> relative_error =3D abs( original_image - new_image)/original_image
>
> (you can multiply by 100 to make it percentage if you like).
>
> Division is done element by element. =A0(since images are 2D matrices).
>
> Then you could take the mean of the resulting relative_error image to obt=
ain
> one single numerical value.
>
> --Nasser

Ok...thanks a lot nasser!!I got the solution...

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com