How can I make a variable defined in one script make change also in a second script?
Show older comments
MOTIVATION: I wrote the following lines to obtain the distance of a give moving point between two images:
open cpcorr.m;
P2=4;
base_points_0 = [ 75 24 ];
input_points_0 =[ 75 24 ];
imagea = imread('0.bmp');
imageb = imread('1.bmp');
image1 = rgb2gray(imagea);
image2 = rgb2gray(imageb);
y = zeros(1,2,4);
[input_points, base_points] = cpselect(image2,image1, input_points_0, base_points_0, 'wait', true);
y(:,:,1) = base_points;
corrected_inputs = cpcorr(input_points, base_points, image2, image1);
y(:,:,2) = corrected_inputs;
input_points = corrected_inputs;
base_points = corrected_inputs;
filename1 = '1.bmp';
PROBLEM: The value 4 of variable P2 should be assigned to the correlation size (CORRSIZE = P2) in cpcorr.m but unfortunately I obtain the following error:
??? Undefined function or variable 'P2'.
Error in ==> cpcorr at 76
CORRSIZE = P2;
QUESTION: How can I write a value in the calculation script that makes a change in cpcorr.m without needing to change that number manually?
Thank you for your help
Emerson
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!