English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

have to find centre of white ball and mark it with 'x' and print centre co-ordinates for each frame in opencv in linux.

#include "cv.h"
#include "highgui.h"
#include
#include
#include
int u,v,y_raw;
int topixel(int d) {
if (d>254) return 255;
if (d<1) return 0;
return (int) d;
}
int YUVtoR(int y, int u, int v){
int r;
r=topixel((int)((y-16)*1.164+1.596*(v-128)));
return (r);
}
int YUVtoG(int y, int u, int v){
int g;
g=topixel((int)((y-16)*1.164-0.392*(u-128)-0.813*(v-128)));
return (g);
}
int YUVtoB(int y, int u, int v){
int b;
b=topixel((int)((y-16)*1.164+2.017*(u-128)));
return (b);
}
void convertYUVtoBGR(unsigned char *imagedata, unsigned char
*buffer, int width, int height) {
int i=0;
for (i = 0; i < width * height; i++) {
y_raw=buffer[i];
u=buffer[(width*height)+((((i/width)/2)*width)/2)+((i%
width)/2)];
v=buffer[(width*height)+(int)(0.25*width*height)+
((((i/width)/2)*width)/2)+((i%width)/2)];
imagedata[i*3]=YUVtoB(y_raw,u,v);
imagedata[(i*3)+1]

2006-06-08 16:14:52 · 1 answers · asked by blackcat_win 1 in Computers & Internet Programming & Design

1 answers

The above program code is incomplete.

2006-06-08 23:16:31 · answer #1 · answered by DevanamPriyadarshi 3 · 0 0

fedest.com, questions and answers