Reputation: 1452
So i making image from camera,via native API. The problem is that,i also have an algorithms to compute some stuff(with bitmap) and problem comes,when resolution is too high(for e.g. 3000x2500),because i need wait too much time.
So first what comes in my mind,its like a workaround:
So how can i achieve this part? I think it's possible,but cant understand what exactly need to do.
Thanks!
Upvotes: 0
Views: 120
Reputation: 4575
OK, that is what you need
assuming you have computed some x, y values for you low res image:
int lowResX, lowResY;
Than for converting them to the hi res:
double scaleRatio = hiResImageWidth / lowResImageWidth; //be sure to use here double or float values as the result of integer division will be int, and not the double/float!
int hiResX = (int) (lowResX * scaleRatio);
int hiResY = (int) (lowResY * scaleRatio);
That's all
Upvotes: 1
Reputation: 1206
If you know the x,y position in your w,h bitmap then the X,Y you are looking for in your W,H bitmap are just simple ratios
x/w = X/W which you can solve easily : X = x * W/w
Similarly you get Y = y * H/h
Upvotes: 1