Finding interaction point between the images in seperate plots
===


Actually I need to get the boundary of two images and place them together to know where there is maximum point of extraction. I got both the images cleared and plotted but i dont know to bring them together and check the interaction points.

Am new to matlab ...
I dont even know if all these code ihave put in is correct
 

close all;

clear all;

RGB = imread('D:\Nichu\My works at Home\ME comp sci\semIII\project\sample1-grid.png');

figure,imshow(RGB);

I = rgb2gray(RGB);

threshold = graythresh(I);

figure,imshow(I);

BW = im2bw(I,threshold);

figure,imshow(BW);

BW2 = bwmorph(BW,'thicken');

BW3 = bwmorph(BW2,'remove');

BW4 = bwmorph(BW3,'close');

BWI = bwmorph(BW4,'remove');

dim = size(BWI);

col = round(dim(2)/2)-90;

row = find(BWI(:,col), 1);

display(row);

connectivity = 8;

num_points   = 1800;

contour = bwtraceboundary(BWI, [row, col], 'N', connectivity, num_points);

imshow(BWI);

clf('reset');

hold on;

plot(contour(:,2),contour(:,1),'g','LineWidth',2);

RGB2 = imread('D:\Nichu\My works at Home\ME comp sci\semIII\project\sample2-grid.png');

figure,imshow(RGB2);

I1 = rgb2gray(RGB2);

threshold = graythresh(I1);

figure,imshow(I1);

BWA = im2bw(I1,threshold);

figure,imshow(BWA);

BWb = bwmorph(BWA,'thicken');

BWc = bwmorph(BWb,'remove');

BWd = bwmorph(BWc,'close');

BWE = bwmorph(BWd,'remove');

dima = size(BWE);

cola = round(dima(2)/2)-90;

rowa = find(BWE(:,col), 1);

connectivity = 8;

num_points   = 1800;

contour = bwtraceboundary(BWE, [rowa, cola], 'N', connectivity, num_points);

imshow(BWE);

clf('reset');

hold on;

plot(contour(:,2),contour(:,1),'g','LineWidth',2);

plot(70,230,'ko','markersize',15,'LineWidth',2);

