Thursday 22 November 2018

                   Floor Detection Application

Detect and display the floor using Live Images:

Demo Output:

Input Images Used:



Output Images:

AI Model Segmented Images:



                                        RND using MATLAB Programming

MATLAB Code start here

clc

clear all

close all;

% [a,b]=uigetfile('*.jpg','Segmented    1   image');

rgb=imread('\correct\10r.jpg');

figure,imshow(rgb) 

title('Segmented image')

%  Threshold 

% Pixel 143 71 111 %% in gray 97

gray=rgb2gray(rgb);

figure,imshow(gray) 

title('Segmented grayscale')

hl=gray<97;

hl=find(hl==1);

sz=size(gray)

mask=zeros(sz);

mask(hl)=255;

figure,imshow(mask)

title('binary image')

BW2 = bwareaopen(mask, 2945);

figure,imshow(BW2)

% se = strel('ball',2,5);

% se = strel('disk',2);

% afterOpening = imopen(mask,se);

% se = strel('disk',11);        

% se2 = strel('line',3,90)

se = strel('disk',2);        

se2 = strel('line',3,90)

IM2 = imdilate(BW2,se);

figure,imshow(IM2)

title('smoothed edge')

hls=find(IM2==1);

nohls=find(IM2==0);

edg_img=edge(IM2,'Canny');

figure,imshow(edg_img)

title('coordinate edge')

% [a1,b]=uigetfile('*.jpg','original');

% original=imread('correct\2.jpg');

% figure,imshow(original)

floor_img=imread('\tl2.jpg');

original=rgb;

red_l=original(:,:,1);

green_l=original(:,:,2);

blue_l=original(:,:,3);

red_l(hls)=255;

green_l(hls)=0.22;

blue_l(hls)=0.33;

seg=cat(3,red_l,green_l,blue_l);

figure,imshow(seg)

%% sheet read

% [ax,vx]=uigetfile('*.jpg');

% sheet=imread(ax);

sheet=imread('\tl2.jpg');

sh=size(rgb);

resz=imresize(sheet,sh(1:2));

r_resz=resz(:,:,1);

g_resz=resz(:,:,2);

b_resz=resz(:,:,3);

r_resz(nohls)=0;

g_resz(nohls)=0;

b_resz(nohls)=0;

recn=cat(3,r_resz,g_resz,b_resz);

red_l(hls)=0;

green_l(hls)=0;

blue_l(hls)=0;

figure,imshow(r_resz)

figure,imshow(red_l)

r1=imfuse(red_l,r_resz,'blend','Scaling','joint');

g1=imfuse(green_l,g_resz,'blend','Scaling','joint');

b1=imfuse(blue_l,b_resz,'blend','Scaling','joint');

recon=cat(3,r1,g1,b1);

figure,imshow(recon*2)

imwrite(recon*2,'rechanged8.jpg')

figure,imshow(imfuse(red_l,r_resz,'blend','Scaling','joint'))


                       Application Development using Python

Packages Installation:

1.Python 3.6 

Packages:

pip install opencv-contrib-python=3.4.2.17

pip install pixellib

pip intall numpy

Module run:

Input parameters:

# model_root=r'.hf'  ## model root

# input_imgdir='' ## Input Image root

# output_imgdir= '' ## Segment root

# sheet_image='' ## Floor sheet image root 

# Smoothed_root='' # Final input root

How to use Packages Import ?

import floorgui

import imgmerg

image_segment(model_root,input_imgdir,output_imgdir,sheet_image,Smoothed_root)

How to Run:

Use Test.py-----Testing 

Terminal : python Test.py

Model Download Link:

https://drive.google.com/file/d/1q6dZmlc6_H-B8i-yS_fGsXVQ8lFjy3zw/view?usp=sharing

Source Code Link:


















6 comments:

  1. How to read DICOM image in MATLAB ?

    ReplyDelete
    Replies
    1. clc
      clear all;
      close all;
      dicom_image=dicomread('slides.dcm');
      figure,imshow(dicom)

      Delete
  2. How to read 4D dicom image in MATLAB?

    clc
    clear all;
    close all;
    dcm_imag=dicomread('dcmslids.dcm');
    %% dcm_imag contains bellow N number of slides
    %% 1024 X 1024 X 500
    %% here third layer 500 its called slides





    ReplyDelete
  3. How can I read and show image as sequentially from folder using python [example images like 0.jpg, 1.jpg, 2.jpg,n.jpg?

    ReplyDelete
    Replies
    1. You can use like sorting and deserting function

      Delete