问题遇到的现象和发生背景
matlab调用C++文件出错
用代码块功能插入代码,请勿粘贴截图
InputImg=imread('DSH.jpg');
Normalization=1;
SpaceSize=1080;
PatchSize=[6:4:22];
VanishNumber=3;
diamond_vanish1(InputImg, Normalization, SpaceSize, PatchSize, VanishNumber);
function [Result] = diamond_vanish1(InputImg, Normalization, SpaceSize, PatchSize, VanishNumber)
% Detection of vanishing point using diamond space.
%
% Results = DIAMOND_VANISH(InputImg, Normalization, SpaceSize, PatchSize)
%
% Input:
% InputImg input image
% Normalization float number;
% normalization of the image (1 means normalization form -1 to 1)
% SpaceSize int number;
% resolution of the accumulation space (final space has dims SpaceSize x SpaceSize)
% PatchSize int row vector;
% radius of a patch, from which edge pixels are extracted and use for ellipse fitting for detection of orientation of the edge point
%
% Output:
% Results structure with fields:
% Results.Space accumulated diamond space (further is used for orthogonalization)
% Results.PC_VanP positions of the maxima in R.Space
% Results.PC_VanP_Norm normalized position of the maxima (R.Space bounded from -1 to 1)
% Results.CC_VanP position of the vanishing point in the input image coordinates
%find edge points
EdgeImg = edge(rgb2gray(InputImg),'canny');
%find lines
LinesData = mx_lines(int32(padarray(EdgeImg,[PatchSize(end),PatchSize(end)])), int32(PatchSize));
LinesData(3,:) = LinesData(3,:)*Normalization;
SubPixelRadius = 2;
Threshold = 0.05;
Result = struct('Space', [], 'PC_VanP',[], 'PC_VanP_Norm', [], 'CC_VanP', []);
%diamond stuff
for V = 1:VanishNumber
%raster and find space
space = mx_raster_space(SpaceSize, LinesData);
%figure
%imagesc(space);
Result.PC_VanP(V,:) = find_maximum(space, SubPixelRadius);
if(V == 1) Result.Space = space; end
%normalize result
Result.PC_VanP_Norm(V,:) = normalize_PC_points(Result.PC_VanP(V,:), SpaceSize);
%get lines close to VP
Distance = point_to_lines_dist(Result.PC_VanP_Norm(V,:), LinesData(1:3,:)');
%remove lines
LinesData(:,(Distance < Threshold)') = [];
end
Result.CC_VanP = PC_point_to_CC(Normalization, Result.PC_VanP_Norm, size(InputImg));
end
运行结果及报错内容
函数或变量 'mx_lines' 无法识别。
出错 diamond_vanish>diamond_vanish1 (第 33 行)
LinesData = mx_lines(int32(padarray(EdgeImg,[PatchSize(end),PatchSize(end)])), int32(PatchSize));
出错 diamond_vanish (第 6 行)
diamond_vanish1(InputImg, Normalization, SpaceSize, PatchSize, VanishNumber);