# scaling contour

hello , im new with openframeworks , i been experimenting with countour interaction …my questions are :which is the best way of scaling a countour? im using the vector with the contour data and i would like to scale this data. my question is: if i use :
contourFinder.draw(20,20, 640, 480);

i can scale the countour in the way how it looks, but does it also scale the vector data?

and my second question is : if i draw each blob individually as im doing for using the vector data i cant use the scale , ex:

for (int j = 0; j < contourFinder.nBlobs; j++){
contourFinder.blobs[j].draw(20, 20);

}

in this example 20, 20 just define the position but i cannot scale like contourFinder.draw(20,20, 640, 480); where 640 , 480 define the scale.

how can i scale?
OR maybe is a better idea to draw a big video instead of drawing a small video and scaling the countour data, which is better in terms of cpu process?

many thanks

Matias.

hi Matias,

the draw() function does not scale the underlying data, it just scales it when it is drawn.

in fact, the 640*480 doesn’t define a ‘scale’, but rather it says ‘figure out a scale to draw the contours in a 640*480 rectangle, and draw at that scale.’ if the input image that the contours were taken from was a 320*240 image, then 640*480 will draw at xScale = 2 and yScale = 2.

in terms of processing power, the cost of scaling a bunch of vectors is so much smaller than the cost of running through the image looking for the vectors in the first place, that it really doesn’t matter which way you do it.

[quote author=“damian”]hi Matias,

the draw() function does not scale the underlying data, it just scales it when it is drawn.

in fact, the 640*480 doesn’t define a ‘scale’, but rather it says ‘figure out a scale to draw the contours in a 640*480 rectangle, and draw at that scale.’ if the input image that the contours were taken from was a 320*240 image, then 640*480 will draw at xScale = 2 and yScale = 2.

in terms of processing power, the cost of scaling a bunch of vectors is so much smaller than the cost of running through the image looking for the vectors in the first place, that it really doesn’t matter which way you do it.[/quote]

thanks, but how can i scale the vector? is there an automatic way of scale the vector pts? or do i need to iterate all over the vector ?

bye

yeah, you need to iterate over all of them as far as i know…

hi , ive tried the following code for scaling the vector of each blob, and now im getting a wierd behaivor in my programs, now i have lot of copies of the my contourn , is there anything im mising? or any idea of what a im doing wrong?