Ask your own question, for FREE!
Computer Science 23 Online
OpenStudy (anonymous):

I have a very basic question about matlab. Can someone help me.

OpenStudy (anonymous):

Im using one code form the help in matlab. As a result I have A vector or cluster not sure of it. But when I type the variable "line" in the command window, I get what is shown in the attached image

OpenStudy (anonymous):

my question is: how do I read data from for example point one. Im finishing my semester project dude and I just need to be able to read that data

OpenStudy (anonymous):

point1, point2, etc are embeded into the variable line.

OpenStudy (anonymous):

do you want me to send you the code?

OpenStudy (anonymous):

clc % Leer la imagen I = imread('test2.jpg'); % Pasar a escala gris I = rgb2gray(I); % Binarizar la imagen BW = edge(I,'canny'); % Calculo de la transformada de hough [H,T,R] = hough(BW); P = houghpeaks(H,2); x = T(P(:,2)); y = R(P(:,1)); % Find lines and plot them lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7); figure, imshow(I), hold on max_len = 0; for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green'); % Plot beginnings and ends of lines plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); % Determine the endpoints of the longest line segment len = norm(lines(k).point1 - lines(k).point2); if ( len > max_len) max_len = len; xy_long = xy; end end

OpenStudy (anonymous):

OpenStudy (anonymous):

you should place that image in the folder you run the code

OpenStudy (anonymous):

you put in you code "lines(k).point1" and that how you can get point1 value is not it ?

OpenStudy (anonymous):

I think I already found the answer

OpenStudy (anonymous):

did you run the code?

OpenStudy (anonymous):

now I dont have matlab in my PC

OpenStudy (anonymous):

I type this "lines(:,1)" and I got into the firs subarray. Im lucky

OpenStudy (anonymous):

by "lines(:,1) you get all elements in the subarray number 1

OpenStudy (anonymous):

then what should I do. Coz data is still embeded into three subarrayis

OpenStudy (anonymous):

point1: [180 436] point2: [362 436] theta: -90 rho: -434.7394

OpenStudy (anonymous):

just need point one and 2

OpenStudy (anonymous):

lines(1,1) to get the value 180 and so on

OpenStudy (anonymous):

No Im stuck. Its not working

OpenStudy (anonymous):

when you write lines(:,1) , what did you get ?

OpenStudy (anonymous):

point1: [180 436] point2: [362 436] theta: -90 rho: -434.7394

OpenStudy (anonymous):

I stored that into variable A

OpenStudy (anonymous):

you got all the results just when you type :lines(:,1) ?

OpenStudy (anonymous):

then I tried A(:,1) in order to get point1. I though that could work

OpenStudy (anonymous):

yeah. I think lines is comprised of sub-arrays (point1, point2, theta, rho)

OpenStudy (anonymous):

try lines(1).point1 or lines.point1

OpenStudy (anonymous):

YEAH!

OpenStudy (anonymous):

it did work haha

OpenStudy (anonymous):

thank you so much

OpenStudy (anonymous):

:)

OpenStudy (anonymous):

good for you you are welcome any time :)

OpenStudy (anonymous):

shadyak can u help me

OpenStudy (anonymous):

ok write a new question

OpenStudy (anonymous):

i wrote already which is the best and fastest downloading manager except internet download manager

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!