铜雀春深锁阿瞒 2022-09-16 21:25 采纳率: 0%
浏览 9

matlab如何调用C++

问题遇到的现象和发生背景

matlab调用C++文件出错

img

用代码块功能插入代码,请勿粘贴截图

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);

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-16 22:04
    关注
    评论

报告相同问题?

问题事件

  • 创建了问题 9月16日

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制