2つの質問があります構造体からdoubleへの変換はできません
(1)このエラーはなぜ発生しますか? double
はどこから来たのですか?
Error using horzcat
The following error occurred converting from double to struct:
Error using struct
Conversion to struct from double is not possible.
Error in remove_scratch (line 34)
old1 = [lines1, max_vertex1] ;
(2)このエラーを取り除くにはどうすればよいですか?
関連するソースコード
for n = 1:N
% take n-th image
hough_trf_input = monochrome_image(:,:,n);
% find straight lines in the image
[hough_lines, thetas] = hugh_transform(hough_trf_input);
%////////////////////////////////////////////////////////////
[lines1, max_vertex1] = find_lines(hough_lines, thetas(1));
[lines2, max_vertex2] = find_lines(hough_lines, thetas(2));
[lines3, max_vertex3] = find_lines(hough_lines, thetas(3));
if(n==1)
old1 = [lines1, max_vertex1];
old2 = [lines2, max_vertex2];
old3 = [lines3, max_vertex3];
else
oldlen1 = vertex_length(old1(2));
oldlen2 = vertex_length(old2(2));
oldlen3 = vertex_length(old3(2));
newlen1 = vertex_length(max_vertex1);
newlen2 = vertex_length(max_vertex2);
newlen3 = vertex_length(max_vertex3);
if(newlen1 > oldlen1)
old1 = [lines1, max_vertex1] ;
end
if(newlen2 > oldlen2)
old2 = [lines2, max_vertex2] ;
end
if(newlen3 > oldlen3)
old3 = [lines3, max_vertex3] ;
end
end
end
ここfind_lines()
は、その第1要素line
-structsのベクトルであるベクトルを返し、第2の要素は、各ベクトルは2要素である2つのベクトルのベクトルであり、軸を表します。
私たちは何を出力知っている必要がありますタイプは 'find_lines'です。また、 'old1'、' old2'、 'old3'のような連続した番号の変数名ではなく、配列を使うべきですか?実際、これはセルアレイの仕事かもしれません。 – beaker
@beaker、 'find_lines()'は、第1要素が 'line'オブジェクトのベクトルであるベクトルを返し、第2要素は2要素のベクトルで、各ベクトルは2要素で軸を表します。 – anonymous