Effacer les filtres
Effacer les filtres

I have generated a image that is to be cropped in 8 equal parts ???

2 vues (au cours des 30 derniers jours)
AMIT VERMA
AMIT VERMA le 2 Fév 2015
Commenté : AMIT VERMA le 3 Fév 2015
I could not start this program because of some reasons please somebody help me
  4 commentaires
Meghana Dinesh
Meghana Dinesh le 2 Fév 2015
Give us a little more details....if you want any help.
AMIT VERMA
AMIT VERMA le 3 Fév 2015
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;
originalImage=imread('C:\Users\AMIT\Desktop\CB\sulphur\4-5.jpg');
subplot(2,2,1);
imshow(originalImage);
axis on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Segregation', 'NumberTitle', 'Off')
BW = ~im2bw(originalImage,0.5);
subplot(2,2,2);
imshow(BW, []);
axis on;
promptMessage = sprintf('Do you want to crop the image,\nor Cancel to abort processing?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
message = sprintf('Drag out a box in the upper right image\nthen double-click inside to finish');
uiwait(helpdlg(message));
croppedImage = imcrop(BW);
bw2 = bwareaopen(croppedImage, 3);
bw2 = imclearborder(bw2); % Get rid of huge white surround.
subplot(2,2,3);
imshow(bw2)
axis on;
[labeledimage, numberofobjects] = bwlabel(bw2);
numberofobjects
message = sprintf('The number of objects = %d', numberofobjects);
uiwait(helpdlg(message));
measurements = regionprops(labeledimage, 'Area');
allAreas=0.1517*[measurements.Area];
allAreas
%allAreas = sort([measurements.Area], 'Descend')
% _ _ *here I was manually cropping my area of interest from the image but now I have to automatically divide it in equal parts?* _ _

Connectez-vous pour commenter.

Réponses (1)

Stalin Samuel
Stalin Samuel le 2 Fév 2015
  1 commentaire
AMIT VERMA
AMIT VERMA le 3 Fév 2015
Modifié(e) : AMIT VERMA le 3 Fév 2015
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;
originalImage=imread('C:\Users\AMIT\Desktop\CB\sulphur\4-5.jpg');
subplot(2,2,1);
imshow(originalImage);
axis on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Segregation', 'NumberTitle', 'Off')
BW = ~im2bw(originalImage,0.5);
subplot(2,2,2);
imshow(BW, []);
axis on;
promptMessage = sprintf('Do you want to crop the image,\nor Cancel to abort processing?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
message = sprintf('Drag out a box in the upper right image\nthen double-click inside to finish');
uiwait(helpdlg(message));
croppedImage = imcrop(BW);
bw2 = bwareaopen(croppedImage, 3);
bw2 = imclearborder(bw2); % Get rid of huge white surround.
subplot(2,2,3);
imshow(bw2)
axis on;
[labeledimage, numberofobjects] = bwlabel(bw2);
numberofobjects
message = sprintf('The number of objects = %d', numberofobjects);
uiwait(helpdlg(message));
measurements = regionprops(labeledimage, 'Area');
allAreas=0.1517*[measurements.Area];
allAreas
%allAreas = sort([measurements.Area], 'Descend')
% _ _ *here I was manually cropping my area of interest from the image but now I have to automatically divide it in equal parts?* _ _

Connectez-vous pour commenter.

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by