Click here to Skip to main content
15,888,112 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to read an array from 1 class to another Pin
Richard MacCutchan30-Apr-15 21:16
mveRichard MacCutchan30-Apr-15 21:16 
GeneralRe: How to read an array from 1 class to another Pin
David A. Gray3-May-15 10:12
David A. Gray3-May-15 10:12 
Questionc sharp - Confusing string manipulation Pin
Member 1115178230-Apr-15 7:31
Member 1115178230-Apr-15 7:31 
AnswerRe: c sharp - Confusing string manipulation Pin
Matt T Heffron30-Apr-15 8:17
professionalMatt T Heffron30-Apr-15 8:17 
GeneralRe: c sharp - Confusing string manipulation Pin
David A. Gray1-May-15 11:13
David A. Gray1-May-15 11:13 
GeneralRe: c sharp - Confusing string manipulation Pin
Matt T Heffron1-May-15 11:31
professionalMatt T Heffron1-May-15 11:31 
GeneralRe: c sharp - Confusing string manipulation Pin
David A. Gray1-May-15 19:08
David A. Gray1-May-15 19:08 
QuestionCan any one help me to convert amatlab code to c# ,please? Pin
Member 1147426930-Apr-15 5:41
Member 1147426930-Apr-15 5:41 
function [bestParameter1,bestParameter2] = ransac_demo(data,num,iter,threshDist,inlierRatio)
% data: a 2xn dataset with #n data points
% num: the minimum number of points. For line fitting problem, num=2
% iter: the number of iterations
% threshDist: the threshold of the distances between points and the fitting line
% inlierRatio: the threshold of the numer of inliers

%% Plot the data points
figure;plot(data(1,Smile | :) ,data(2,Smile | :) ,'o');hold on;
number = size(data,2); % Total number of points
bestInNum = 0; % Best fitting line with largest number of inliers
bestParameter1=0;bestParameter2=0; % parameters for best fitting line
for i=1:iter
%% Randomly select 2 points
idx = randperm(number,num); sample = data(:,idx);
%% Compute the distances between all points with the fitting line
kLine = sample(:,2)-sample(:,1);
kLineNorm = kLine/norm(kLine);
normVector = [-kLineNorm(2),kLineNorm(1)];
distance = normVector*(data - repmat(sample(:,1),1,number));
%% Compute the inliers with distances smaller than the threshold
inlierIdx = find(abs(distance)<=threshDist);
inlierNum = length(inlierIdx);
%% Update the number of inliers and fitting model if better model is found
if inlierNum>=round(inlierRatio*number) && inlierNum>bestInNum
bestInNum = inlierNum;
parameter1 = (sample(2,2)-sample(2,1))/(sample(1,2)-sample(1,1));
parameter2 = sample(2,1)-parameter1*sample(1,1);
bestParameter1=parameter1; bestParameter2=parameter2;
end
end

%% Plot the best fitting line
xAxis = -number/2:number/2;
yAxis = bestParameter1*xAxis + bestParameter2;
plot(xAxis,yAxis,'r-','LineWidth',2);
AnswerRe: Can any one help me to convert amatlab code to c# ,please? Pin
OriginalGriff30-Apr-15 5:58
mveOriginalGriff30-Apr-15 5:58 
AnswerRe: Can any one help me to convert amatlab code to c# ,please? Pin
Eddy Vluggen30-Apr-15 5:58
professionalEddy Vluggen30-Apr-15 5:58 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Kenneth Haugland30-Apr-15 6:06
mvaKenneth Haugland30-Apr-15 6:06 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Eddy Vluggen30-Apr-15 8:51
professionalEddy Vluggen30-Apr-15 8:51 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Member 1147426930-Apr-15 11:01
Member 1147426930-Apr-15 11:01 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Eddy Vluggen30-Apr-15 11:22
professionalEddy Vluggen30-Apr-15 11:22 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Member 1147426930-Apr-15 11:37
Member 1147426930-Apr-15 11:37 
GeneralRe: Can any one help me to convert amatlab code to c# ,please? Pin
Eddy Vluggen30-Apr-15 21:39
professionalEddy Vluggen30-Apr-15 21:39 
AnswerRe: Can any one help me to convert amatlab code to c# ,please? Pin
Kenneth Haugland30-Apr-15 6:03
mvaKenneth Haugland30-Apr-15 6:03 
Questionproblem in code Port.ReadTo Pin
hasan hadi30-Apr-15 4:46
hasan hadi30-Apr-15 4:46 
Questionlocomp instrumentation Pin
hasan hadi30-Apr-15 4:11
hasan hadi30-Apr-15 4:11 
AnswerRe: locomp instrumentation Pin
Eddy Vluggen30-Apr-15 4:17
professionalEddy Vluggen30-Apr-15 4:17 
AnswerRe: locomp instrumentation Pin
OriginalGriff30-Apr-15 4:21
mveOriginalGriff30-Apr-15 4:21 
GeneralRe: locomp instrumentation Pin
hasan hadi30-Apr-15 5:41
hasan hadi30-Apr-15 5:41 
GeneralRe: locomp instrumentation Pin
OriginalGriff30-Apr-15 5:57
mveOriginalGriff30-Apr-15 5:57 
AnswerRe: locomp instrumentation Pin
Pete O'Hanlon30-Apr-15 5:22
mvePete O'Hanlon30-Apr-15 5:22 
GeneralRe: locomp instrumentation Pin
hasan hadi30-Apr-15 5:38
hasan hadi30-Apr-15 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.