function [bbox_loc,sign_objects,index1,st,furniture]=classify_objects_test1(I1) % clear all; % clc; % close all; I_initial=imread("C:\\Users\\User\\Desktop\\tkinter_codes\\floorplans\\ROBIN\\Dataset_3roomsmall\\Cat1_1.jpg"); %I_initial = imread('room_4.png'); I=I_initial; imshow(I); SE = strel('square',10); I = imdilate(I,SE); SE = strel('square',10); I = imerode(I,SE); wall_image=I; wall = I; I=I_initial; wall=im2bw(wall); imshow(wall); I=im2bw(I); I=imcomplement(I); wall = imcomplement(wall); I=I-wall; % imshow(I); I=imcomplement(I); SE = strel('square',1); IM2 = imdilate(I,SE); IM2 = I; IM2 = imerode(IM2,SE); imwrite(IM2,'fl_0sym.tif'); se1=strel('square',8); intm1=imerode(IM2,se1); se2=strel('square',4); intm2=imdilate(intm1,se2); intm3=imdilate(intm2,se2); imwrite(intm3,'fl_0sym1.tif'); I = imread('fl_0sym1.tif'); I = imcomplement(I); J = imfill(I); J = ~J; imwrite(J,'blb_0_1.jpg'); figure=I_initial; [m,n] = size(figure); figure1 = figure(:,:,[1 1 1]); figure = im2bw(figure); [m,n] = size(figure); image = imread('blb_0_1.jpg'); BW = im2bw(image); BW = imresize(BW,[m,n]); BW = ~BW; %for 4,1,9,8 SE = strel('square',10); BW = imdilate(BW,SE); %% figure;imshow(BW); st = regionprops(BW,'BoundingBox'); shape.Inserter = vision.ShapeInserter('LineWidth',4,'BorderColor','Custom','CustomBorderColor',uint8([255 0 0])); str_ele=strel('disk',1,0); for k = 1:length(st) % k=1; % for k = 1:1 thisBB = st(k).BoundingBox; %figure1 = step(shape.Inserter,figure1,bbox_loc{k}); thisBBarea=thisBB(3)*thisBB(4); if thisBB(3)>20 && thisBB(4)>20 rectangle = int32([thisBB(1),thisBB(2),thisBB(3),thisBB(4)]); end if(thisBBarea >870) bbox_loc{k}=rectangle; crop_I_new=imcrop(figure1,rectangle); crop_I_new_gray=rgb2gray(crop_I_new); crop_I=im2bw(crop_I_new_gray,0.7); % figure;imshow(crop_I); signature{k}=signature_find(crop_I); if isempty(signature{k}) signature{k}=[99999,99999,99999]; end figure1 = step(shape.Inserter,figure1,bbox_loc{k}); end end signature=signature(~cellfun('isempty',signature)); save('signature.mat','signature'); signature=load('signature.mat'); sign_objects=load('sign_object2'); for i=1:length(signature.signature) for j=1:length(sign_objects.sign_object2) diff{i,j}=abs(signature.signature{1,i}-sign_objects.sign_object2{j,1}.count); end end for(i=1:size(diff,1)) for(j=1:size(diff,2)) if(sign_objects.sign_object2{j,1}.count(3)>1000) temp1(i,j)=diff{i,j}(1)+diff{i,j}(2); else temp1(i,j)=diff{i,j}(1)+diff{i,j}(2)+diff{i,j}(3); end end end for(i=1:size(temp1,1)) [temp1_min(i),index1(i)]=min(temp1(i,:)); disp(sign_objects.sign_object2{index1(i),2}); furniture{i,1}=sign_objects.sign_object2{index1(i),2} figure;imshow(figure1); bbox_loc=bbox_loc(~cellfun('isempty',bbox_loc)); end for k = 1:length(bbox_loc) H= text( double(bbox_loc{k}(1)),double(bbox_loc{k}(2)),sign_objects.sign_object2{index1(k),2}); set(gcf,'DefaultTextColor','blue') end % for i=1:size(diff,1) % for j=1:size(diff,2) % % temp1(i,j)=(diff{i,j}(1)); % temp2(i,j)=(diff{i,j}(2)); % temp3(i,j)=(diff{i,j}(3)); % % % end % [temp1_min(i),index1(i)]=min(temp1(i,:)); % disp(sign_objects.sign_object1{index1(i),2}); % furniture{i,1}=sign_objects.sign_object1{index1(i),2} % end
This is the image with only walls.
One approach is to close all of the doors morphologically:
load('Walls') e=ones(1,105); A=imclose(imclose(~Image,e),e.'); B=imfill(A,'holes')&~A; imshow(B)
Now, you can simply use regionprops to get all of the pixel coordinates in each room,
>> Rooms=regionprops(B,'PixelList') Rooms = 3×1 struct array with fields: PixelList
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.