Skip to content

Commit

Permalink
new back car light: include/utils.h
Browse files Browse the repository at this point in the history
	a robust corner detector under test:   src/imageprocessing.c
	video debugging disabled:   src/sensors.c
	modified:   src/vehicle.c
  • Loading branch information
ckevar committed Jan 2, 2019
1 parent 8f0447e commit a53f03f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/** CAR LIGHTS **/
#define CAR_RUNNING 14
#define CAR_STOPPED 12
#define CAR_STOPPED makecol(255,50,50)

/* Inits grid map */
void initGridMap(int *tl_matrix, const int street_w, const int block_w);
Expand Down
17 changes: 12 additions & 5 deletions src/imageprocessing.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,23 @@ void *fastHarrisRobertCornerDetection(void *void_im) {
int dx, dy; // derivatives
int cornerCounter = 0; // number of corners

for (i = 1; i < VRES - 1; i++) {
for (j = 1; j < HRES - 1; j++) {
for (i = 1; i < VRES - 3; i++) {
for (j = 1; j < HRES - 3; j++) {

dx = abs(im->im[i * HRES + j] - im->im[(i + 1) * HRES + j + 1]); // P - c
dy = abs(im->im[i * HRES + j + 1] - im->im[(i + 1) * HRES + j]); // a - b

if (dx != dy) { // if they are different then pixel at i,j is a corner
im->ft.x[cornerCounter] = i;
im->ft.y[cornerCounter] = j;
cornerCounter++;
/* re-checking some pixels further increases robusticity*/
dx = abs(im->im[i * HRES + j] - im->im[(i + 3) * HRES + j + 3]); // P - c
dy = abs(im->im[i * HRES + j + 3] - im->im[(i + 3) * HRES + j]); // a - b

if (dx != dy) {
im->ft.x[cornerCounter] = i;
im->ft.y[cornerCounter] = j;
cornerCounter++;
}

}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ void analyzeCameraFrame(vehicle_t *c, imfeatures_t *imft) {
}
}

/* Morphology ops will go here */
// delation(bwStreetTmp, bwStreet.im);
RosenfeldPfaltz(bwTL, &imft->TLcenter, 0);
fastHarrisRobertCornerDetection(&bwStreet);
imft->stCorner = bwStreet.ft;
Expand Down
1 change: 1 addition & 0 deletions src/vehicle.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ void *moveVehicle(void *myV) {
circlefill(screen, c->xr - c->l/4 * cos(c->theta), c->yr - c->l/4 * sin(c->theta), c->w / 2 - 3, CAR_RUNNING);
pthread_mutex_unlock(&screen_lock);
} else {
/** RED LIGHTS display at the back of the car when it's stopped **/
circlefill(screen, c->xr - c->l/4 * cos(c->theta), c->yr - c->l/4 * sin(c->theta), c->w / 2 - 3, CAR_STOPPED);
}

Expand Down

0 comments on commit a53f03f

Please sign in to comment.