Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

help me(vc++)

i want to ask you about one more problem..
i scanned document containing fingerprints(3 in count) as 24 bit bmp at 100 dpi..and i have displayed it in view.from that i need to select those fingerprints by using scanner and i need to display them in 500 dpi..(only those FP's)is it possible
[305 byte] By [simplyvenky10] at [2007-11-11 10:29:20]
# 1 Re: help me(vc++)
Hi,

you need to do some interpolation. Because you scanned with 100 and want to display with 500 dpi you need to calculate 4 additional points between each original point.
Be aware you have to do the interpolation in x direction and in y direction.
You can use for example linear approximation or some clever spline approximation.
I should be surprised, though, if there was not some code on the Web.
Cheers,
D
drkybelk at 2007-11-11 20:58:50 >
# 2 Re: help me(vc++)
I think you want to look at "bicubic" interpolation.
jonnin at 2007-11-11 20:59:44 >
# 3 Re: help me(vc++)
quick and dirty example for linear interpolation:

#include <iostream>
#include <vector>
using namespace std;
struct clr24
{
clr24(unsigned char red=0,unsigned char green=0,unsigned char blue=0)
: r(red),g(green),b(blue)
{
}
unsigned char r,g,b;
};

typedef vector<clr24> ColorList;

void interpolate(clr24 c1,clr24 c2,unsigned long num, ColorList& result)
{
if(num == 0)
return;

double r1 = c1.r, r2 = c2.r,
g1 = c1.g, g2 = c2.g,
b1 = c1.b, b2 = c2.b;
double stepr = double(r2 - r1)/double(num);
double stepg = double(g2 - g1)/double(num);
double stepb = double(b2 - b1)/double(num);

result.resize(0);

for(unsigned long i = 0; i < num+1; i++)
{
result.push_back(clr24(r1+stepr*i,g1+stepg*i,b1+stepb*i));
}
}
int main()
{
clr24 red(255,0,0);
clr24 darkblue(0,0,128);
ColorList cl;
interpolate(red,darkblue,10,cl);

for(ColorList::iterator it = cl.begin(); it != cl.end(); it++)
{
cout << (int)it->r << "," << (int)it->g << "," << (int)it->b <<endl;
}

return 0;
}

Just to get you going ;-)

D
drkybelk at 2007-11-11 21:00:44 >