📄 printbyrowcol.cpp
字号:
#include <stdio.h>
#include <windows.h>
#include "../utils/bmpUtils/bmpUtils.h"
#include "../mavis/imgUtil/all.h"
#include "../mavis/mavistypes.h"
using namespace std;
void printPoints(FpImgSet *, int h, int r, int c);
int main(int argc, char** argv)
{
VideoFrame_t frame;
HINSTANCE bmpLib = NULL;
GETBMPSIZEPROC procGetBmpSize = NULL;
GETBMPBYTESPROC procGetBmpBytes = NULL;
bmpLib = LoadLibrary("bmpUtils");
if(!bmpLib)
{
fprintf(stderr, "Can't load dll");
return -1;
}
procGetBmpSize = (GETBMPSIZEPROC)GetProcAddress(bmpLib, "getBmpSize");
procGetBmpBytes = (GETBMPBYTESPROC)GetProcAddress(bmpLib, "getBmpBytes");
// read in bitmap file
procGetBmpSize(&frame.width, &frame.height, "rgb_1.bmp");
printf("w = %d, h = %d\n", frame.width, frame.height);
frame.pixel = new BYTE[3*frame.width*frame.height];
procGetBmpBytes(frame.width, frame.height, "rgb_1.bmp", frame.pixel);
// color conversion
FpImgSet * pRGB = 0;
//ColorUtil::frame2rgb(&frame, &pRGB);
//ColorUtil::frame2hsv(&frame, &pRGB);
ColorUtil::frame2normrgb(&frame, &pRGB);
printf( "%d images in set\n", pRGB->size() );
printPoints(pRGB, frame.height, 112, 27);
printPoints(pRGB, frame.height, 19, 90);
printPoints(pRGB, frame.height, 240, 320);
// check for memory leaks
while(1)
{
FpImgSet * pSet2 = 0;
ColorUtil::frame2normrgb(&frame, &pSet2);
Sleep(10L);
delete pSet2;
//FpImg * pImg = new FpImg(frame.height, frame.width);
//Sleep(10L);
//delete pImg;
}
if(bmpLib) FreeLibrary(bmpLib);
if(frame.pixel) delete[] frame.pixel;
return 0;
}
void printPoints(FpImgSet * pSet, int h, int rMatlab, int cMatlab)
{
int nImg = pSet->size();
int y = h-rMatlab;
int x = cMatlab-1;
for(int i=0; i<nImg; i++)
{
FpImg * pImg = pSet->accessImg(i);
double ** yxdata = pImg->getYXData();
printf("img_%d(%d,%d) = %.4g\n", i+1, rMatlab, cMatlab, yxdata[y][x]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -