Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!npeer01.iad.highwinds-media.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe01.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: I need to help?
References: <gb0kj5$ov3$1@fred.mathworks.com> <e7ea5034-2104-4ba0-8820-104944d5d5a3@f36g2000hsa.googlegroups.com> <95fd5329-1f60-4e26-9749-9f14566c5ac3@m45g2000hsb.googlegroups.com> <gb137u$n54$1@fred.mathworks.com> <j7VAk.522$zk7.162@newsfe06.iad> <gb1e8d$3q1$1@fred.mathworks.com> <xJnBk.11462$Il.5926@newsfe09.iad> <gb584e$mb5$1@fred.mathworks.com> <Z_uBk.16998$wr1.9977@newsfe02.iad> <gb64t3$aib$1@fred.mathworks.com>
In-Reply-To: <gb64t3$aib$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 64
Message-ID: <6TRBk.14$Cl1.13@newsfe01.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe01.iad 1222109762 24.79.146.116 (Mon, 22 Sep 2008 18:56:02 UTC)
NNTP-Posting-Date: Mon, 22 Sep 2008 18:56:02 UTC
Date: Mon, 22 Sep 2008 13:56:39 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:491381


ABUTALA wrote:
> Thank Walter Roberson.
> 
> Well, what is code that i add it to program and then program find the quality?

I have indicated the necessary change below.

> clear all
> close all

Right here, add the statement

quality = -8.3156;

The rest of your program remains the same.

The quality of *every* image is -8.3156, no matter what the image contains
(with the exception that the quality of images which are 0 by 0 is NaN.)

But be cautioned that markers are often very stubborn, and often
issue "Fail" marks for programs that are correct but which disagree
with what was taught in the reference material, so it would probably be
-safer- for you to use the definition of quality given in your course
instead of using the Universal Quality Constant of -8.3156 that I show here.

Just out of curiosity, how does your course reference material define "quality" ?


> [InputFileName, InputPathName] = uigetfile('*.tif', 'Select Input Image');
>    InputImageName = strcat(InputPathName,InputFileName)
>     cover=imread(InputImageName);
>     
>     if ndims(cover) == 3
>     cover = rgb2gray(cover);
>   end
>     
>     figure, imshow(cover,[])   %Display the cover image
>     
>     [InputFileName, InputPathName] = uigetfile('*.tif', 'Select  Image to hide');
>    InputImageName = strcat(InputPathName,InputFileName)
>     hidden=imread(InputImageName);
>     if ndims(hidden) == 3
>     hidden = rgb2gray(hidden);
>   end
>     figure, imshow(hidden,[])
>     alpha = .02; %Strength of the hidden information
>     stego = (1-alpha) * cover + alpha * hidden;
>     
>     figure, imshow(stego, []);
>     reconstructed = (stego - (1-alpha) * cover)./alpha;
>     figure, imshow(reconstructed, []);
>     
>     %%%See the difference between reconstructed and hidden
>     diff = hidden - reconstructed;
>  if reconstructed == hidden
>    error('Images are identical: PSNR has infinite value')
> end
> max2_A = max(max(reconstructed));
> max2_B = max(max(hidden));
> min2_A = min(min(reconstructed));
> min2_B = min(min(hidden));
> er = reconstructed - hidden;
> decibels = 20*log10(1/(sqrt(mean(mean(er.^2)))))
> plot(stego,reconstructed)