/* main function */ int main() { // empty buffers memset(inputimage, 0, HEIGHT*WIDTH*sizeof(unsigned char)); memset(outputimage_2, 0, HEIGHT*WIDTH*sizeof(unsigned char)); memset(outputimage_4, 0, HEIGHT*WIDTH*sizeof(unsigned char)); memset(outputimage_5, 0, HEIGHT*WIDTH*sizeof(unsigned char)); // read image(s) ReadImage("rose.raw", inputimage); //Set two least significant bits to zero and produce an image ProcessImage(inputimage, outputimage_2, 2); /* RAW */ WriteImage("output_2.raw", outputimage_2); //Set four least significant bits to zero and produce an image ProcessImage(inputimage, outputimage_4, 4); WriteImage("output_4.raw", outputimage_4); //Set five least significant bits to zero and produce an image ProcessImage(inputimage, outputimage_5, 5); WriteImage("output_5.raw", outputimage_5); return 0; }
tResult TemporalImage::OnPinEvent(IPin *source, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample *mediaSample) { if (nEventCode != IPinEventSink::PE_MediaSampleReceived) { RETURN_NOERROR; } RETURN_IF_POINTER_NULL(mediaSample); logger.StartLog(); if (source == &videoInputPin) { VisionUtils::ExtractImageFromMediaSample(mediaSample, videoInputFormat).copyTo(workingImage); RETURN_IF_POINTER_NULL(workingImage.data); ProcessImage(); TransmitOutput(mediaSample->GetTime()); tFloat diff = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0; logger.Log(cString::Format("Total depth image processing time: %f ms", diff).GetPtr()); } else if (source == &videoOutputPin) { } else { RETURN_ERROR(ERR_NOT_SUPPORTED); } logger.EndLog(); RETURN_NOERROR; }
int NetPacket::ProcessRequest(struct payload_req *req, char *buf) { printf("%s\n", __func__); switch (req->type & 0xFF000000) { case REQ_TYPE_HEARTBEAT: return ProcessHeartBeat(req, buf); break; case REQ_TYPE_RUNNING: return ProcessRunning(req, buf); break; case REQ_TYPE_MANUFACTURE: return ProcessMannufacture(req, buf); break; case REQ_TYPE_HW_DEBUG: break; case REQ_TYPE_SW_DEBUG: break; case REQ_TYPE_IMAGE: return ProcessImage(req, buf); break; default: break; } return -1; }
void CamShiftPlugin::OnOK() { wxBeginBusyCursor(); if (!GetScope()) ProcessImage(cm->book[cm->GetPos()], cm->GetPos()); else{ FetchParams(); ImagePlus *oimg; CvRect orect, searchwin; CvPoint ocenter; oimg = cm->book[0]; int numContours = (int) oimg->contourArray.size(); for (int i=1; i<cm->GetFrameCount(); i++) cm->book[i]->CloneContours(oimg); int frameCount = cm->GetFrameCount(); CreateProgressDlg(numContours*frameCount); bool cont=true; for (int j=0; j<numContours && cont; j++){ for (int i=1; i<frameCount && (cont=progressDlg->Update(j*frameCount+i, wxString::Format("Cell %d of %d, Frame %d of %d", j+1,numContours, i+1, frameCount))); i++){ ProcessStatic(j, cm->book[i], cm->book[useFirst ? 0 : i-1], hsizes, criteria, planes, hist, backproject, orect, ocenter, searchwin, rotation, shift, i>1); } } DestroyProgressDlg(); } cm->ReloadCurrentFrameContours(true, false); wxEndBusyCursor(); }
void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif FX_BOOL bRet = FALSE; switch (pObj->GetType()) { case CPDF_PageObject::TEXT: bRet = ProcessText(pObj->AsText(), pObj2Device, nullptr); break; case CPDF_PageObject::PATH: bRet = ProcessPath(pObj->AsPath(), pObj2Device); break; case CPDF_PageObject::IMAGE: bRet = ProcessImage(pObj->AsImage(), pObj2Device); break; case CPDF_PageObject::SHADING: ProcessShading(pObj->AsShading(), pObj2Device); return; case CPDF_PageObject::FORM: bRet = ProcessForm(pObj->AsForm(), pObj2Device); break; } if (!bRet) DrawObjWithBackground(pObj, pObj2Device); #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif }
/** * Grabs the most recent image written by "motion". */ void ImageHandler::GrabImage() { std::string jpg_str, cmd; cmd = std::string("ls -1rt ") + std::string(IMAGE_DIR) + std::string(" |tail -1"); //Yes, it's probably better to use readdir etc. instead of ls jpg_str = std::string(IMAGE_DIR) + GetStdoutFromCommand(cmd); //TODO: Optimize me jpg_str.erase(std::remove(jpg_str.begin(), jpg_str.end(), '\n'), jpg_str.end()); (void)pthread_mutex_lock(&image_queue_lock); image_queue.push(jpg_str); //If this is the only thing in the queue, go ahead and send the image //for processing if(image_queue.size() == 1) { ProcessImage(image_queue.front()); } else { Print::Blue("Another image is in the queue. Deferring processing.\n"); } (void)pthread_mutex_unlock(&image_queue_lock); }
void CPDF_RenderStatus::ProcessObjectNoClip( const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device) { FX_BOOL bRet = FALSE; switch (pObj->m_Type) { case PDFPAGE_TEXT: bRet = ProcessText((CPDF_TextObject*)pObj, pObj2Device, NULL); break; case PDFPAGE_PATH: bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); break; case PDFPAGE_IMAGE: bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); break; case PDFPAGE_SHADING: bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device); break; case PDFPAGE_FORM: bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); break; } if (!bRet) { DrawObjWithBackground(pObj, pObj2Device); } }
void MatchTemplatePlugin::DoPreview() { if (!IsPreviewOn()) return; cm->ReloadCurrentFrameContours(false); ProcessImage(&cm->img, cm->GetPos(), cm->GetZPos()); cm->Redraw(false); }
void CamShiftPlugin::DoPreview() { if (!IsPreviewOn()) return; cm->ReloadCurrentFrameContours(false); ProcessImage(&cm->img, cm->GetPos()); cm->Redraw(false); }
void NormalizeContoursPlugin::DoPreview() { if (!IsPreviewOn()) return; cm->ReloadCurrentFrameContours(false); ProcessImage(&cm->img); cm->Redraw(false); }
void SmoothPlugin::DoPreview() { if (!IsPreviewOn()) return; cm->ReloadCurrentFrame(false); ProcessImage(&cm->img); cm->Redraw(false); }
void FindFeaturesPlugin::DoPreview() { if (!IsPreviewOn()) return; if (!sidebar->clean->GetValue()) cm->ReloadCurrentFrameContours(false); ProcessImage(&cm->img); cm->Redraw(false); }
void DebayerVideo::ProcessStreams(unsigned char* out, const unsigned char *in) { for(size_t s=0; s<streams.size(); ++s) { const StreamInfo& stin = videoin[0]->Streams()[s]; if(stin.PixFormat().bpp == 8) { Image<unsigned char> img_in = stin.StreamImage(in); Image<unsigned char> img_out = Streams()[s].StreamImage(out); ProcessImage(img_out, img_in, methods[s], tile); }else if(stin.PixFormat().bpp == 16){ Image<uint16_t> img_in = stin.StreamImage(in).Reinterpret<uint16_t>(); Image<uint16_t> img_out = Streams()[s].StreamImage(out).Reinterpret<uint16_t>(); ProcessImage(img_out, img_in, methods[s], tile); }else{ throw std::runtime_error("debayer: unhandled format combination: " + stin.PixFormat().format ); } } }
/** * Dequeues images upon notification that processing is done. If there are * additional images in the queue, sends the next one for processing. */ void ImageHandler::DequeueImagesThread() { Print::Blue("Starting image dequeue thread\n"); int pipe; unsigned char processing_done; while(true) { //Named pipe must be reopened every time or it will still //have the previous data //Always use open instead of fopen for named pipes to avoid deadlocks pipe = open("/usr/local/share/MotionHandler/processing_done_pipe", O_RDONLY); if(pipe < 0) { Print::Err("Image dequeue - Can't open pipe\n" " Terminating image dequeue thread.\n"); pthread_exit(NULL); } (void)read(pipe, &processing_done, 1); (void)read(pipe, NULL, 3); close(pipe); if(processing_done == 0x01) { if(image_queue.size() == 0) { Print::Err("Image dequeue - No images in queue\n"); continue; } Print::Blue("Processing done. Popping the image queue.\n"); DeleteImage(image_queue.front()); //Image processing is finished. //Pop the queue and send off the next image (void)pthread_mutex_lock(&image_queue_lock); image_queue.pop(); if(image_queue.size() > 0) { Print::Blue("Another image is in the queue. Processing.\n"); ProcessImage(image_queue.front()); } (void)pthread_mutex_unlock(&image_queue_lock); } else if(processing_done != 0x42) { // Print::Err("Image dequeue - Received unexpected " // "data from the pipe. Verify that only one instance " // "of this program is running.\n"); } } }
status_t _GlValue2d::PerformImage(GlImage* img, const gl_process_args* args) { if (mTargets == 0) return B_OK; if (img->InitCheck() != B_OK) return B_ERROR; GlPlanes* pixels = img->LockPixels(mTargets, true); ArpASSERT(pixels); status_t err = B_OK; if (pixels) err = ProcessImage(pixels, (args) ? args->status : 0); img->UnlockPixels(pixels); return err; }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessXml(xml_node * rootXml, Model3dBuilder * builder) { // process images xml_node* images = FindChildByName(rootXml, "library_images"); for(xml_node* node = FindChildByName(images, "image"); node != NULL; node=FindNextByName(node, "image")) { ProcessImage(builder, node); } // process materials xml_node* mats = FindChildByName(rootXml, "library_materials"); for(xml_node* node = FindChildByName(mats, "material"); node != NULL; node=FindNextByName(node, "material")) { ProcessMaterial(builder, node); } // process effects xml_node* effects = FindChildByName(rootXml, "library_effects"); for(xml_node* node = FindChildByName(effects, "effect"); node != NULL; node=FindNextByName(node, "effect")) { ProcessEffect(builder, node); } // process geometries xml_node* geos = FindChildByName(rootXml, "library_geometries"); for(xml_node* node = FindChildByName(geos, "geometry"); node != NULL; node=FindNextByName(node, "geometry")) { ProcessGeo(builder, node); } // process controllers ControllerToGeo controllerToGeo; xml_node* controllers = FindChildByName(rootXml, "library_controllers"); for(xml_node* node = FindChildByName(controllers, "controller"); node != NULL; node=FindNextByName(node, "controller")) { ProcessController(node, &controllerToGeo); } // process visual scene xml_node* scenes = FindChildByName(rootXml, "library_visual_scenes"); xml_node* scene = FindChildByName(scenes, "visual_scene"); // just grab the 1st visual scene if(scene) { const char * nodeName = GetAttributeText(scene, "id", true); if (!nodeName) { nodeName = "!missing-id!"; } Node * rootNode = builder->m_model->CreateNode(nodeName); builder->m_model->SetRoot(rootNode); ProcessChildNodes(builder, scene, rootNode, &controllerToGeo); } }
/* main function */ int main() { // empty buffers memset(inputimage, 0, HEIGHT*WIDTH*sizeof(unsigned char)); memset(outputimage, 0, HEIGHT*WIDTH*sizeof(unsigned char)); // read image(s) ReadImage("testpattern.raw", inputimage); InitFilter(); ProcessImage(inputimage, outputimage); WriteImage("smoothed.raw", outputimage); return 0; }
void DebayerVideo::ProcessStreams(unsigned char* out, const unsigned char *in) { for(size_t s=0; s<streams.size(); ++s) { const StreamInfo& stin = videoin[0]->Streams()[s]; Image<unsigned char> img_in = stin.StreamImage(in); Image<unsigned char> img_out = Streams()[s].StreamImage(out); if(methods[s] == BAYER_METHOD_NONE) { const size_t num_bytes = std::min(img_in.w, img_out.w) * stin.PixFormat().bpp / 8; for(size_t y=0; y < img_out.h; ++y) { std::memcpy(img_out.RowPtr((int)y), img_in.RowPtr((int)y), num_bytes); } }else if(stin.PixFormat().bpp == 8) { ProcessImage(img_out, img_in, methods[s], tile); }else if(stin.PixFormat().bpp == 16){ Image<uint16_t> img_in16 = img_in.UnsafeReinterpret<uint16_t>(); Image<uint16_t> img_out16 = img_out.UnsafeReinterpret<uint16_t>(); ProcessImage(img_out16, img_in16, methods[s], tile); }else { throw std::runtime_error("debayer: unhandled format combination: " + stin.PixFormat().format ); } } }
int VideoInput::ReadFrame(void) { struct v4l2_buffer buf; unsigned int i; switch (io) { case IO_METHOD_READ: if (-1 == read(fd, buffers->buffer, buffers[0].bufferlen)) ErrnoError("read"); ProcessImage(buffers->buffer); break; case IO_METHOD_MMAP: CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (-1 == Xioctl(VIDIOC_DQBUF, &buf)) ErrnoError("VIDIOC_DQBUF"); if (buf.index >= n_buffers) cout << "VideoInput: Index error\n"; assert(buf.index < n_buffers); ProcessImage(buffers[buf.index].buffer); if (-1 == Xioctl(VIDIOC_QBUF, &buf)) ErrnoError("VIDIOC_QBUF"); break; } return errored; }
void CVisionTestDlg::OnProcess() { POSITION pos; CString strFile; if ( m_lImagefiles.IsEmpty() ) return; pos = m_lImagefiles.GetHeadPosition(); while (pos != NULL) { strFile = m_lImagefiles.GetNext(pos); ProcessImage( strFile ); } }
//////////////////////////////////////////////////////////////////////////////// // Process an incoming message int CameraSimulator::ProcessMessage(QueuePointer & resp_queue, player_msghdr * hdr, void * data) { assert(hdr); // if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA, PLAYER_POSITION2D_DATA_STATE, position_addr)) { assert(data); player_position2d_data_t * recv = reinterpret_cast<player_position2d_data_t *> (data); th = recv->pos.pa; x = recv->pos.px; y = recv->pos.py; ProcessImage(); return 0; } return -1; }
FX_BOOL CPDF_RenderStatus::DrawObjWithBlend( const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device) { FX_BOOL bRet = FALSE; switch (pObj->m_Type) { case PDFPAGE_PATH: bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); break; case PDFPAGE_IMAGE: bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); break; case PDFPAGE_FORM: bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); break; } return bRet; }
FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device) { FX_BOOL bRet = FALSE; switch (pObj->GetType()) { case CPDF_PageObject::PATH: bRet = ProcessPath(pObj->AsPath(), pObj2Device); break; case CPDF_PageObject::IMAGE: bRet = ProcessImage(pObj->AsImage(), pObj2Device); break; case CPDF_PageObject::FORM: bRet = ProcessForm(pObj->AsForm(), pObj2Device); break; default: break; } return bRet; }
void CPDF_PageContentGenerator::GenerateContent() { CFX_ByteTextBuf buf; CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; for (int i = 0; i < m_pageObjects.GetSize(); ++i) { CPDF_PageObject* pPageObj = m_pageObjects[i]; if (!pPageObj || !pPageObj->IsImage()) { continue; } ProcessImage(buf, pPageObj->AsImage()); } CPDF_Object* pContent = pPageDict ? pPageDict->GetDirectObjectFor("Contents") : nullptr; if (pContent) pPageDict->RemoveFor("Contents"); CPDF_Stream* pStream = new CPDF_Stream; pStream->SetData(buf.GetBuffer(), buf.GetLength()); pPageDict->SetReferenceFor("Contents", m_pDocument, m_pDocument->AddIndirectObject(pStream)); }
void CPDF_PageContentGenerate::GenerateContent() { CFX_ByteTextBuf buf; CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; for (int i = 0; i < m_pageObjects.GetSize(); ++i) { CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_pageObjects[i]; if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) { continue; } ProcessImage(buf, (CPDF_ImageObject*)pPageObj); } CPDF_Object* pContent = pPageDict ? pPageDict->GetElementValue("Contents") : NULL; if (pContent != NULL) { pPageDict->RemoveAt("Contents"); } CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); }
int main(int argc, char *argv[]) { /* initialization */ memset( inputimage, 0, HEIGHT*WIDTH*sizeof(uchar_t) ); memset( outputimage, 0, HEIGHT*WIDTH*sizeof(uchar_t) ); /* command line arguments */ if(argc != 2) { error((char *)"USAGE: %s <image.raw>\n", argv[0]); } /* read image */ ReadImage( argv[1], inputimage ); /* process image */ ProcessImage(); /* write image */ WriteImage((char*)"mb_out.raw", outputimage ); return 0; }
int CALLBACK _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { /* Find name of image */ if (!GetModuleFileName(NULL, ImageFileName, MAX_PATH)) { FATAL("Failed to get executable name (error %lu).", GetLastError()); return -1; } /* Set up environment */ SetEnvironmentVariable(_T("OCRA_EXECUTABLE"), ImageFileName); SetConsoleCtrlHandler(&ConsoleHandleRoutine, TRUE); /* Open the image (executable) */ HANDLE hImage = CreateFile(ImageFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hImage == INVALID_HANDLE_VALUE) { FATAL("Failed to open executable (%s)", ImageFileName); return -1; } /* Create a file mapping */ DWORD FileSize = GetFileSize(hImage, NULL); HANDLE hMem = CreateFileMapping(hImage, NULL, PAGE_READONLY, 0, FileSize, NULL); if (hMem == INVALID_HANDLE_VALUE) { FATAL("Failed to create file mapping (error %lu)", GetLastError()); CloseHandle(hImage); return -1; } /* Map the image into memory */ LPVOID lpv = MapViewOfFile(hMem, FILE_MAP_READ, 0, 0, 0); if (lpv == NULL) { FATAL("Failed to map view of executable into memory (error %lu).", GetLastError()); } else { if (!ProcessImage(lpv, FileSize)) ExitStatus = -1; if (!UnmapViewOfFile(lpv)) FATAL("Failed to unmap view of executable."); } if (!CloseHandle(hMem)) FATAL("Failed to close file mapping."); if (!CloseHandle(hImage)) FATAL("Failed to close executable."); if (PostCreateProcess_ApplicationName && PostCreateProcess_CommandLine) { DEBUG("**********"); DEBUG("Starting app in: %s", InstDir); DEBUG("**********"); CreateAndWaitForProcess(PostCreateProcess_ApplicationName, PostCreateProcess_CommandLine); } if (DeleteInstDirEnabled) { DEBUG("Deleting temporary installation directory %s", InstDir); SHFILEOPSTRUCT shop; shop.hwnd = NULL; shop.wFunc = FO_DELETE; InstDir[lstrlen(InstDir) + sizeof(TCHAR)] = 0; shop.pFrom = InstDir; shop.pTo = NULL; shop.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; SHFileOperation(&shop); } ExitProcess(ExitStatus); /* Never gets here */ return 0; }
static int drawing_test() { static int read_params = 0; static int read = 0; const int channel = 3; CvSize size = cvSize(600, 300); int i, j; int Errors = 0; if( !read_params ) { read_params = 1; trsCaseRead( &read, "/n/y", "y", "Read from file ?" ); } // Create image IplImage* image = cvCreateImage( size, IPL_DEPTH_8U, channel ); // cvLine cvZero( image ); for( i = 0; i < 100; i++ ) { CvPoint p1 = cvPoint( i - 30, i * 4 + 10 ); CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 ); cvLine( image, p1, p2, CV_RGB(178+i, 255-i, i), i % 10 ); } Errors += ProcessImage( image, "cvLine", read ); // cvLineAA cvZero( image ); for( i = 0; i < 100; i++ ) { CvPoint p1 = cvPoint( i - 30, i * 4 + 10 ); CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 ); cvLine( image, p1, p2, CV_RGB(178+i, 255-i, i), 1, CV_AA, 0 ); } //Errors += ProcessImage( image, "cvLineAA", read ); // cvRectangle cvZero( image ); for( i = 0; i < 100; i++ ) { CvPoint p1 = cvPoint( i - 30, i * 4 + 10 ); CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 ); cvRectangle( image, p1, p2, CV_RGB(178+i, 255-i, i), i % 10 ); } Errors += ProcessImage( image, "cvRectangle", read ); #if 0 named_window( "Diff", 0 ); #endif // cvCircle cvZero( image ); for( i = 0; i < 100; i++ ) { CvPoint p1 = cvPoint( i * 3, i * 2 ); CvPoint p2 = cvPoint( size.width - i * 3, size.height - i * 2 ); cvCircle( image, p1, i, CV_RGB(178+i, 255-i, i), i % 10 ); cvCircle( image, p2, i, CV_RGB(178+i, 255-i, i), i % 10 ); #if 0 show_iplimage( "Diff", image ); wait_key(0); #endif } Errors += ProcessImage( image, "cvCircle", read ); // cvCircleAA cvZero( image ); for( i = 0; i < 100; i++ ) { CvPoint p1 = cvPoint( i * 3, i * 2 ); CvPoint p2 = cvPoint( size.width - i * 3, size.height - i * 2 ); cvCircleAA( image, p1, i, RGB(i, 255 - i, 178 + i), 0 ); cvCircleAA( image, p2, i, RGB(i, 255 - i, 178 + i), 0 ); } Errors += ProcessImage( image, "cvCircleAA", read ); // cvEllipse cvZero( image ); for( i = 10; i < 100; i += 10 ) { CvPoint p1 = cvPoint( i * 6, i * 3 ); CvSize axes = cvSize( i * 3, i * 2 ); cvEllipse( image, p1, axes, 180 * i / 100, 90 * i / 100, 90 * (i - 100) / 100, CV_RGB(178+i, 255-i, i), i % 10 ); } Errors += ProcessImage( image, "cvEllipse", read ); // cvEllipseAA cvZero( image ); for( i = 10; i < 100; i += 10 ) { CvPoint p1 = cvPoint( i * 6, i * 3 ); CvSize axes = cvSize( i * 3, i * 2 ); cvEllipseAA( image, p1, axes, 180 * i / 100, 90 * i / 100, 90 * (i - 100) / 100, RGB(i, 255 - i, 178 + i), i % 10 ); } Errors += ProcessImage( image, "cvEllipseAA", read ); // cvFillConvexPoly cvZero( image ); for( j = 0; j < 5; j++ ) for( i = 0; i < 100; i += 10 ) { CvPoint p[4] = {{ j * 100 - 10, i }, { j * 100 + 10, i }, { j * 100 + 30, i * 2 }, { j * 100 + 170, i * 3 }}; cvFillConvexPoly( image, p, 4, CV_RGB(178+i, 255-i, i) ); } Errors += ProcessImage( image, "cvFillConvexPoly", read ); // cvFillPoly cvZero( image ); for( i = 0; i < 100; i += 10 ) { CvPoint p0[] = {{-10, i}, { 10, i}, { 30, i * 2}, {170, i * 3}}; CvPoint p1[] = {{ 90, i}, {110, i}, {130, i * 2}, {270, i * 3}}; CvPoint p2[] = {{190, i}, {210, i}, {230, i * 2}, {370, i * 3}}; CvPoint p3[] = {{290, i}, {310, i}, {330, i * 2}, {470, i * 3}}; CvPoint p4[] = {{390, i}, {410, i}, {430, i * 2}, {570, i * 3}}; CvPoint* p[] = {p0, p1, p2, p3, p4}; int n[] = {4, 4, 4, 4, 4}; cvFillPoly( image, p, n, 5, CV_RGB(178+i, 255-i, i) ); } Errors += ProcessImage( image, "cvFillPoly", read ); // cvPolyLine cvZero( image ); for( i = 0; i < 100; i += 10 ) { CvPoint p0[] = {{-10, i}, { 10, i}, { 30, i * 2}, {170, i * 3}}; CvPoint p1[] = {{ 90, i}, {110, i}, {130, i * 2}, {270, i * 3}}; CvPoint p2[] = {{190, i}, {210, i}, {230, i * 2}, {370, i * 3}}; CvPoint p3[] = {{290, i}, {310, i}, {330, i * 2}, {470, i * 3}}; CvPoint p4[] = {{390, i}, {410, i}, {430, i * 2}, {570, i * 3}}; CvPoint* p[] = {p0, p1, p2, p3, p4}; int n[] = {4, 4, 4, 4, 4}; cvPolyLine( image, p, n, 5, 1, CV_RGB(178+i, 255-i, i), i % 10 ); } Errors += ProcessImage( image, "cvPolyLine", read ); // cvPolyLineAA cvZero( image ); for( i = 0; i < 100; i += 10 ) { CvPoint p0[] = {{-10, i}, { 10, i}, { 30, i * 2}, {170, i * 3}}; CvPoint p1[] = {{ 90, i}, {110, i}, {130, i * 2}, {270, i * 3}}; CvPoint p2[] = {{190, i}, {210, i}, {230, i * 2}, {370, i * 3}}; CvPoint p3[] = {{290, i}, {310, i}, {330, i * 2}, {470, i * 3}}; CvPoint p4[] = {{390, i}, {410, i}, {430, i * 2}, {570, i * 3}}; CvPoint* p[] = {p0, p1, p2, p3, p4}; int n[] = {4, 4, 4, 4, 4}; cvPolyLineAA( image, p, n, 5, 1, RGB(i, 255 - i, 178 + i), 0 ); } Errors += ProcessImage( image, "cvPolyLineAA", read ); // cvPolyLineAA cvZero( image ); for( i = 1; i < 10; i++ ) { CvFont font; cvInitFont( &font, CV_FONT_VECTOR0, (double)i / 5, (double)i / 5, (double)i / 10, i ); cvPutText( image, "privet. this is test. :)", cvPoint(0, i * 20), &font, CV_RGB(178+i, 255-i, i) ); } Errors += ProcessImage( image, "cvPutText", read ); cvReleaseImage( &image ); return Errors ? trsResult( TRS_FAIL, "errors" ) : trsResult( TRS_OK, "ok" ); }
void MatchTemplatePlugin::OnOK() { wxBeginBusyCursor(); if (GetScope() == 0) // single { if (GetScope2() != 1) // both and normal { ProcessImage( cm->Access(cm->GetPos(),cm->GetZPos(), false), cm->GetPos(), cm->GetZPos()); cm->Release(cm->GetPos(), cm->GetZPos(), false); } if (GetScope2() != 0) // both and fluorescence { ProcessImage( cm->Access(cm->GetPos(),cm->GetZPos(), true), cm->GetPos(), cm->GetZPos()); cm->Release(cm->GetPos(), cm->GetZPos(), true); } } else if (GetScope() == 2) // t-direction { FetchParams(); ImagePlus *oimg; CvRect orect, searchwin; CvPoint ocenter; int frameCount = cm->GetFrameCount(); CreateProgressDlg(frameCount*(GetScope2()==2?2:1)); if (GetScope2() != 1) // both and normal { oimg = cm->Access(0,cm->GetZPos()); int numContours = (int) oimg->contourArray.size(); //cm->Release(0,0, false); for (int i=1; i<frameCount; i++) cm->Access(i,cm->GetZPos(),false,true)->CloneContours(oimg); for (int i=1; i<frameCount && progressDlg->Update(i, wxString::Format(_T("Frame %d of %d"), i+1, frameCount)); i++) { for (int j=0; j<numContours; j++) { ProcessStatic(j, cm->Access(i,cm->GetZPos(), false, false, GetScope()), cm->Access(useFirst ? 0 : i-1,cm->GetZPos()), method, winsize, map); } cm->Release(i-1,cm->GetZPos(),false); } cm->Release(frameCount-1,cm->GetZPos(),false); cm->Release(0,cm->GetZPos(),false); } if (GetScope2() != 0) // both and fluorescence { oimg = cm->Access(0,cm->GetZPos(), true); int numContours = (int) oimg->contourArray.size(); //cm->Release(0,0, false); for (int i=1; i<frameCount; i++) cm->Access(i,cm->GetZPos(),true,true)->CloneContours(oimg); for (int i=1; i<frameCount && progressDlg->Update(i+(GetScope2()==2?frameCount:0), wxString::Format(_T("Frame %d of %d"), i+1, frameCount)); i++) { for (int j=0; j<numContours; j++) { ProcessStatic(j, cm->Access(i,cm->GetZPos(), true, false, GetScope()), cm->Access(useFirst ? 0 : i-1,cm->GetZPos()), method, winsize, map); } cm->Release(i-1,cm->GetZPos(),true); } cm->Release(frameCount-1,cm->GetZPos(),true); cm->Release(0,cm->GetZPos(),true); } DestroyProgressDlg(); } else if (GetScope() == 3) // z-direction { FetchParams(); ImagePlus *oimg; CvRect orect, searchwin; CvPoint ocenter; int slideCount = cm->slideCount; CreateProgressDlg(slideCount*(GetScope2()==2?2:1)); if (GetScope2() != 1) // both and normal { for (int i=1; i<slideCount && progressDlg->Update(i, wxString::Format(_T("Slide %d of %d"), i+1, slideCount)); i++) { oimg = cm->Access(0,i); int numContours = (int) oimg->contourArray.size(); cm->Access(cm->GetPos(),i,false,true)->CloneContours(oimg); for (int j=0; j<numContours; j++) { ProcessStatic(j, cm->Access(cm->GetPos(),i, false, false, GetScope()), cm->Access(useFirst ? 0 : cm->GetPos()-1, i), method, winsize, map); } cm->Release(cm->GetPos(),i,false); cm->Release(cm->GetPos()-1,i,false); cm->Release(0,i,false); } } if (GetScope2() != 0) // both and fluorescence { for (int i=1; i<slideCount && progressDlg->Update(i+(GetScope2()==2?slideCount:0), wxString::Format(_T("Slide %d of %d"), i+1, slideCount)); i++) { oimg = cm->Access(0,i, true); int numContours = (int) oimg->contourArray.size(); cm->Access(cm->GetPos(),i,true,true)->CloneContours(oimg); for (int j=0; j<numContours; j++) { ProcessStatic(j, cm->Access(cm->GetPos(),i, true, false, GetScope()), cm->Access(useFirst ? 0 : cm->GetPos()-1, i), method, winsize, map); } cm->Release(cm->GetPos(),i,true); cm->Release(cm->GetPos()-1,i,true); cm->Release(0,i,true); } } DestroyProgressDlg(); } else { FetchParams(); ImagePlus* oimg; int frameCount = cm->GetFrameCount(); int slideCount = cm->slideCount; CreateProgressDlg(frameCount*slideCount*(GetScope2()==2?2:1)); bool cont=true; for (int slide = 0; slide < slideCount && cont; slide++) { if (GetScope2() != 1) // both and normal { oimg = cm->Access(0, slide,false); for (int i=1; i<frameCount; i++) cm->Access(i,slide,false,true)->CloneContours(oimg); int numContours = (int) oimg->contourArray.size(); for (int i=1; i<frameCount && (cont=progressDlg->Update(slide*frameCount+i, wxString::Format(_T("Frame %d of %d, Slide %d of %d"), i+1, frameCount, slide+1, slideCount))); i++) { for (int j=0; j<numContours; j++) { ProcessStatic(j, cm->Access(i,slide, false, false, GetScope()), cm->Access(useFirst ? 0 : i-1,slide), method, winsize, map); } cm->Release(i-1,slide,false); } cm->Release(frameCount-1,slide,false); cm->Release(0,slide,false); } if (GetScope2() != 0) // both and fluorescence { oimg = cm->Access(0, slide, true); for (int i=1; i<frameCount; i++) cm->Access(i,slide,true,true)->CloneContours(oimg); int numContours = (int) oimg->contourArray.size(); for (int i=1; i<frameCount && cont; i++) { for (int j=0; j<numContours && (cont=progressDlg->Update(slide*frameCount+i+(GetScope2()==2?frameCount*slideCount:0), wxString::Format(_T("Cell %d of %d, Frame %d of %d"), j+1,numContours, i+1, frameCount))); j++) { ProcessStatic(j, cm->Access(i,slide, true, false, GetScope()), cm->Access(useFirst ? 0 : i-1,slide), method, winsize, map); } cm->Release(i-1,slide,true); } cm->Release(frameCount-1,slide,true); cm->Release(0,slide,true); } } DestroyProgressDlg(); } cm->ReloadCurrentFrameContours(true, false); wxEndBusyCursor(); }
void EyeDx(char *up_filename, /* filename of up-image to process; may be empty */ char *side_filename, /* filename of side-image to process; may be empty */ int SideOrientation, /* 0 means left, otherwise right */ int FULL_FLAG) /* flag on outputing full-size annotated images */ { char text[250],text1[250],text2[250],savepath[150]; char BrowserCommand[MAX_FILENAME_CHARS],BrowserPath[MAX_FILENAME_CHARS]; int up_report,side_report,i; double up_lefteye_circles[4],up_righteye_circles[4]; double side_lefteye_circles[4],side_righteye_circles[4]; int up_strabismus,side_strabismus; int up_red_reflex_lumin,side_red_reflex_lumin; int up_left_arr_class,up_right_arr_class; int side_left_arr_class,side_right_arr_class; int up_left_arr_row,up_left_arr_col; int up_right_arr_row,up_right_arr_col; int side_left_arr_row,side_left_arr_col; int side_right_arr_row,side_right_arr_col,Referral; FILE *fpt; struct tm *newtime; time_t aclock; HANDLE hFind; WIN32_FIND_DATA fd; HKEY hKeyHTML,hKeyCommand; DWORD Type,Bytes; char strab_names[6][20]={"N.A.","NONE","EXOTROPIA","ESOTROPIA",\ "HYPERTROPIA","NOT LOOKING?"}; char lumin_names[4][20]={"N.A.","NORMAL","NOT_DETECTED","UNEQUAL"}; char arr_names[4][20]={"N.A.","NONE","CRESCENT","OTHER"}; /********************************************************* ** Process given images. Result for each image is an eye ** model (two concentric circles), a strabismus value (0-5), ** a red reflex luminensce value (0-3), and left & right ** abnormal red reflex values (0-3). *********************************************************/ if (strcmp(up_filename,"") != 0) up_report=ProcessImage(up_filename,0,up_lefteye_circles, up_righteye_circles,&up_strabismus,&up_red_reflex_lumin, &up_left_arr_class,&up_right_arr_class,&up_left_arr_col, &up_left_arr_row,&up_right_arr_col,&up_right_arr_row, FULL_FLAG,1); else up_report=-1; if (strcmp(side_filename,"") != 0 && SideOrientation == 0) side_report=ProcessImage(side_filename,1,side_lefteye_circles, side_righteye_circles,&side_strabismus,&side_red_reflex_lumin, &side_left_arr_class,&side_right_arr_class,&side_left_arr_col, &side_left_arr_row,&side_right_arr_col,&side_right_arr_row, FULL_FLAG,1); else if (strcmp(side_filename,"") != 0 && SideOrientation != 0) side_report=ProcessImage(side_filename,2,side_lefteye_circles, side_righteye_circles,&side_strabismus,&side_red_reflex_lumin, &side_left_arr_class,&side_right_arr_class,&side_left_arr_col, &side_left_arr_row,&side_right_arr_col,&side_right_arr_row, FULL_FLAG,1); else side_report=-1; /********************************************************* ** Make referral decision based on reports *********************************************************/ Referral=0; /* don't refer */ if (up_report >= 0 && side_report >= 0) { if (up_strabismus == 5 || side_strabismus == 5 || (up_strabismus == 0 && side_strabismus == 0)) Referral=2; /* retry */ if (Referral == 0 && (up_strabismus > 1 || side_strabismus > 1 || up_red_reflex_lumin == 2 || side_red_reflex_lumin == 2 || up_right_arr_class > 1 || up_left_arr_class > 1 || side_right_arr_class > 1 || side_left_arr_class > 1)) Referral=1; /* refer */ if (Referral == 1 && up_strabismus == 1 && side_strabismus == 1 && up_red_reflex_lumin == 1 && side_red_reflex_lumin == 1 && up_right_arr_class >= 1 && up_right_arr_class <= 2 && up_left_arr_class >= 1 && up_left_arr_class <= 2 && side_right_arr_class >= 1 && side_right_arr_class <= 2 && side_left_arr_class >= 1 && side_left_arr_class <= 2) if (DialogBox(hInst,"ID_ONE_YEAR_DIALOG",MainWnd,(DLGPROC)YesNoDlgProc) == IDYES) Referral=0; /* crescent only, less than one year old = don't refer */ /* fprintf(fpt,"Strabismus: <B> %s, %s </B><P>\n",strab_names[up_strabismus], strab_names[side_strabismus]); fprintf(fpt,"Red Reflex: <B> %s, %s </B><P>\n", lumin_names[up_red_reflex_lumin], lumin_names[side_red_reflex_lumin]); fprintf(fpt,"Abnormal Pupil Area: <B> %s, %s ; %s , %s </B><P>\n", arr_names[up_right_arr_class],arr_names[up_left_arr_class], arr_names[side_right_arr_class],arr_names[side_left_arr_class]); */ } else if (up_report >= 0) { if (up_strabismus == 5 || up_strabismus == 0) Referral=2; /* retry */ if (Referral == 0 && (up_strabismus > 1 || up_red_reflex_lumin == 2 || up_right_arr_class > 1 || up_left_arr_class > 1)) Referral=1; /* refer */ if (Referral == 1 && side_strabismus == 1 && side_red_reflex_lumin == 1 && side_right_arr_class >= 1 && side_right_arr_class <= 2 && side_left_arr_class >= 1 && side_left_arr_class <= 2) if (DialogBox(hInst,"ID_ONE_YEAR_DIALOG",MainWnd,(DLGPROC)YesNoDlgProc) == IDYES) Referral=0; /* crescent only, less than one year old = don't refer */ /* fprintf(fpt,"Strabismus: <B> %s </B><P>\n",strab_names[up_strabismus]); fprintf(fpt,"Red Reflex: <B> %s </B><P>\n",lumin_names[up_red_reflex_lumin]); fprintf(fpt,"Abnormal Pupil Area: <B> %s, %s </B><P>\n", arr_names[up_right_arr_class],arr_names[up_left_arr_class]); */ } else if (side_report >= 0) { if (side_strabismus == 5 || side_strabismus == 0) Referral=2; /* retry */ if (Referral == 0 && (side_strabismus > 1 || side_red_reflex_lumin == 2 || side_right_arr_class > 1 || side_left_arr_class > 1)) Referral=1; /* refer */ if (Referral == 1 && up_strabismus == 1 && up_red_reflex_lumin == 1 && up_right_arr_class >= 1 && up_right_arr_class <= 2 && up_left_arr_class >= 1 && up_left_arr_class <= 2) if (DialogBox(hInst,"ID_ONE_YEAR_DIALOG",MainWnd,(DLGPROC)YesNoDlgProc) == IDYES) Referral=0; /* crescent only, less than one year old = don't refer */ /* fprintf(fpt,"Strabismus: <B>%s</B><P>\n",strab_names[side_strabismus]); fprintf(fpt,"Red Reflex: <B>%s</B><P>\n",lumin_names[side_red_reflex_lumin]); fprintf(fpt,"Abnormal Pupil Area: <B> %s, %s </B><P>\n", arr_names[side_right_arr_class],arr_names[side_left_arr_class]); */ } /********************************************************* ** Write graphic and/or letter report *********************************************************/ time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct tm form */ if (/* DisplayGraphics == */1) { strcpy(savepath,DataPath); if (savepath[strlen(savepath)-1] != '\\') strcat(savepath,"\\"); strcat(savepath,"reports"); if ((hFind=FindFirstFile(savepath,&fd)) == INVALID_HANDLE_VALUE) { if (!CreateDirectory(savepath,NULL)) { MessageBox(NULL,"Saving report","Unable to create reports folder; saving in runtime folder", MB_APPLMODAL | MB_OK); strcpy(savepath,"."); } } FindClose(hFind); if (up_report >= 0) StripFilename(up_filename,text1); if (side_report >= 0) StripFilename(side_filename,text2); /* if (up_report >= 0 && side_report >= 0) sprintf(text,"%s\\%s-%s.htm",savepath,text1,text2); else if (up_report >= 0) sprintf(text,"%s\\%s.htm",savepath,text1); else sprintf(text,"%s\\%s.htm",savepath,text2); */ sprintf(text,"%s\\%s.htm",savepath,report_filename); if ((fpt=fopen(text,"w")) == NULL) { MessageBox(MainWnd,text,"Unable to open report for writing:",MB_APPLMODAL | MB_OK); exit(0); } fprintf(fpt,"<TITLE>EyeDx Photoscreening Results</TITLE>\n"); fprintf(fpt,"<CENTER><H3>EyeDx Photoscreening Results: %s</H3><P>\n",report_filename); fprintf(fpt,"<H3>Referral recommended: "); if (Referral == 1) fprintf(fpt,"Yes"); else if (Referral == 0) fprintf(fpt,"No"); else fprintf(fpt,"Image(s) unclear. Please repeat."); fprintf(fpt,"</H3><P>\n<CENTER>\n\n"); fprintf(fpt,"<TABLE BORDER=3 CELLSPACING=2 CELLPADDING=2>\n"); fprintf(fpt,"<TR ALIGN=CENTER> "); if (up_report >= 0) fprintf(fpt,"<TD> Photo ID: %s (up) ",text1); if (side_report >= 0) fprintf(fpt,"<TD> Photo ID: %s (%s) ",text2, (SideOrientation == 0 ? "left" : "right")); fprintf(fpt,"\n"); fprintf(fpt,"<TR> "); if (up_report >= 0) fprintf(fpt,"<TD> <IMG HEIGHT=240 WIDTH=320 SRC=\"..\\Simages\\S%s\">\n",&(up_filename[1])); if (side_report >= 0) fprintf(fpt,"<TD> <IMG HEIGHT=240 WIDTH=320 SRC=\"..\\Simages\\S%s\">\n",&(side_filename[1])); fprintf(fpt,"\n"); fprintf(fpt,"<TR ALIGN=CENTER> "); if (up_report >= 0) { fprintf(fpt,"<TD> <TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2>\n"); fprintf(fpt," <TR ALIGN=CENTER> <TD> "); if (up_report == 0) fprintf(fpt,"Please try another photograph.\n"); else { fprintf(fpt,"<IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.right_raw.jpg\">\n",text1); fprintf(fpt," <TD> <IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.left_raw.jpg\">\n",text1); } fprintf(fpt," </TABLE><P>\n"); } if (side_report >= 0) { fprintf(fpt,"<TD> <TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2>\n"); fprintf(fpt," <TR ALIGN=CENTER> <TD> "); if (side_report == 0) fprintf(fpt,"Please try another photograph.\n"); else { fprintf(fpt,"<IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.right_raw.jpg\">\n",text2); fprintf(fpt," <TD> <IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.left_raw.jpg\">\n",text2); } fprintf(fpt," </TABLE><P>\n"); } if (1 /* DisplayGraphics == 1 */) { fprintf(fpt,"<TR ALIGN=CENTER> "); if (up_report >= 0) { fprintf(fpt,"<TD> <TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2>\n"); fprintf(fpt," <TR ALIGN=CENTER> <TD> "); if (up_report == 0) fprintf(fpt,"Photo inconclusive.\n"); else { fprintf(fpt,"<IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.right_eye.jpg\">\n",text1); fprintf(fpt," <TD> <IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.left_eye.jpg\">\n",text1); } fprintf(fpt," </TABLE><P>\n"); } if (side_report >= 0) { fprintf(fpt,"<TD> <TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2>\n"); fprintf(fpt," <TR ALIGN=CENTER> <TD> "); if (side_report == 0) fprintf(fpt,"Photo inconclusive.\n"); else { fprintf(fpt,"<IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.right_eye.jpg\">\n",text2); fprintf(fpt," <TD> <IMG HEIGHT=150 WIDTH=150 SRC=\"..\\eyes\\%s.left_eye.jpg\">\n",text2); } fprintf(fpt," </TABLE><P>\n"); } } fprintf(fpt,"</TABLE><P>\n"); fprintf(fpt,"</CENTER>\n\n"); fprintf(fpt,"EyeDx screening estimates refractive errors, strabismus and pupil opacities.\n"); fprintf(fpt,"Please be aware of the tolerances of the system noted in your manual.\n"); fprintf(fpt,"Display of annotated eyes is for viewing purposes only and is not required\n"); fprintf(fpt,"by the EyeDx software to provide the referral recommendation.\n"); fprintf(fpt,"Patent pending.\n"); fprintf(fpt,"\n<HR>\n\n"); fprintf(fpt,"<ADDRESS> [email protected] / %s / %s </A></ADDRESS>\n",Version,asctime(newtime)); fclose(fpt); } if (1 /* AutoReport == 1 */) { /* look in Windows registry for default command to open html file */ if (RegOpenKeyEx(HKEY_CLASSES_ROOT,".htm",0,KEY_ALL_ACCESS,&hKeyHTML) == ERROR_SUCCESS) { Bytes=250; RegQueryValueEx(hKeyHTML,"",0,&Type,text1,&Bytes); strcat(text1,"\\shell\\open\\command"); if (RegOpenKeyEx(HKEY_CLASSES_ROOT,text1,0,KEY_ALL_ACCESS,&hKeyCommand) == ERROR_SUCCESS) { Bytes=MAX_FILENAME_CHARS; RegQueryValueEx(hKeyCommand,"",0,&Type,BrowserCommand,&Bytes); i=1; while (BrowserCommand[i] != ':' || BrowserCommand[i+1] != '\\') i++; strcpy(BrowserPath,&(BrowserCommand[i-1])); i=0; while (i < (int)strlen(BrowserPath) && BrowserPath[i] != ' ') i++; while (i > 0 && !(BrowserPath[i] == 'e' || BrowserPath[i] == 'E')) i--; BrowserPath[i+1]='\0'; RegCloseKey(hKeyCommand); i=strlen(BrowserPath)-1; while (BrowserPath[i] != '\\') i--; strcpy(BrowserCommand,&(BrowserPath[i+1])); } else { strcpy(BrowserPath,"NotGoingToWork"); strcpy(BrowserCommand,"CouldNotFindIt"); } RegCloseKey(hKeyHTML); if (_spawnlp(_P_NOWAIT,BrowserPath,BrowserCommand,text,NULL) == -1) MessageBox(NULL,"Unable to start web browser.\nPlease display report manually.", "Report finished",MB_OK | MB_APPLMODAL); } else /* try some default locations... */ { if (_spawnlp(_P_NOWAIT,"C:\\Program Files\\Netscape\\Navigator\\Program\\netscape","netscape",text,NULL) == -1) if (_spawnlp(_P_NOWAIT,"C:\\Program Files\\Netscape\\Communicator\\Program\\netscape","netscape",text,NULL) == -1) MessageBox(NULL,"Unable to start web browser.\nPlease display report manually.", "Report finished",MB_OK | MB_APPLMODAL); } } }