void overlayText(FILE* outfile ,struct act* myAct , struct meme* myMeme, struct font* myFont, int i){ int height = myFont->myChars[0].h; int totalWidth = 0; double temp = 0; int len = strlen(myAct->ids[i].value); int* widths = (int*) malloc(len * sizeof(int)); int topX = 0, topY = 0, centerX = 0, centerY = 0, k = 0; struct character* charString = (struct character*) calloc(len, sizeof(struct character)); centerX = myAct->ids[i].x; centerY = myAct->ids[i].y; calculateWidth(myAct, myFont, i, &totalWidth, len, charString, widths); temp = (double) totalWidth / 2.0 ; topX = centerX - temp + 1; topY = centerY - height; for ( k = 0; k < len; k++ ) { overlayImages(myMeme->myImage, charString[k].thisChar, topX, topY); topX += widths[k]; } free(widths); free(charString); }
void FeatureVisualization::overlayAndPublishDisparity(const stereo_msgs::DisparityImage& disparity_img, cv::Mat imageWithFeatures) { //TODO:: find a better way to convert disparity img to cv. const float d_max = disparity_img.max_disparity - disparity_img.min_disparity; sensor_msgs::ImagePtr img_ptr(new sensor_msgs::Image(disparity_img.image)); cv::Mat disparity = convertSensorMsgToCV(img_ptr); cv::Mat output_img; overlayImages(imageWithFeatures, disparity, d_max, output_img); dispaity_image_publisher_.publish(convertCVToSensorMsg(output_img)); }