How to overlap two histograms , one generated from reference image other for noisy image ?

4 visualizzazioni (ultimi 30 giorni)
Actual Program which I tried is,
Prog 1: A = imread('frame2.bmp'); I = rgb2gray(A); J = imnoise(I,'salt & pepper',0.2); figure; imshow(I);title('original image'); figure; imshow(J);title('image with salt&pepper noise=0.2'); figure; imhist(I);title('histogram of refrece image'); figure; imhist(J);title('histogram of salt&pepper noisy image'); figure; K=imhist(I)+imhist(J); hist(K); But didn't get desired output.
  2 Commenti
Preethi  H L
Preethi H L il 13 Ott 2015
My sincere thanks to Image Analyst for the answer with an illustration. Thank you very much
Image Analyst
Image Analyst il 13 Ott 2015
You're welcome. You can also "Thank" me by officially "Accepting" my answer and "Voting" for it.

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 6 Ott 2015
Do you have R2015b? You can overlap histograms with histogram() - just look at the example in the help:
x = randn(2000,1);
y = 1 + randn(5000,1);
h1 = histogram(x);
hold on
h2 = histogram(y);
  3 Commenti
Preethi  H L
Preethi H L il 9 Ott 2015
Modificato: Preethi H L il 9 Ott 2015
I have old version of Matlab and I tried the second code but its showing an error i.e "??? Error using ==> mtimes Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> hist at 78 xx = miny + binwidth*(0:x); " The program on which i tried is, A = imread('frame2.bmp'); I = rgb2gray(A); M=0; V=0.01; J = imnoise(I,'gaussian',M,V); J=im2double(J); figure; imshow(I);title('original image'); figure; imshow(J);title('image with gaussian noise v=0.01'); figure; %imhist(I);title('histogram of refrece image'); h1 = hist(I); plot(h1) hold on h2 = hist(J); plot(h2);title('histogram of image with gauss noise v=0.01');
I have also attached image which I have used.
Image Analyst
Image Analyst il 9 Ott 2015
Try imhist instead of hist:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
rgbImage = imread('peppers.png');
subplot(2,2,1);
imshow(rgbImage);
title('Original RGB Image', 'fontSize', fontSize);
grayImage = rgb2gray(rgbImage);
subplot(2,2,2);
imshow(grayImage);
title('Original Gray Scale Image', 'fontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
M=0;
V=0.01;
noisyImage = imnoise(grayImage,'gaussian',M,V);
noisyImage=im2double(noisyImage);
subplot(2,2,3);
imshow(noisyImage);
title('image with gaussian noise v=0.01', 'fontSize', fontSize);
subplot(2,2,4);
%imhist(I);title('histogram of refrece image');
h1 = imhist(grayImage);
plot(h1)
hold on
h2 = imhist(noisyImage);
plot(h2);
title('histogram of image with gauss noise v=0.01', 'fontSize', fontSize);
grid on;

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by