int main() { IplImage* orginal_image=cvLoadImage("3.7.jpg"); assert(orginal_image!=NULL); IplImage *temp_image=cvCreateImage(cvGetSize(orginal_image),orginal_image->depth,orginal_image->nChannels); assert(temp_image!=NULL); cvNamedWindow("Show"); cvSetMouseCallback("Show",my_callback,(void*)temp_image); while(1) { IplImage *temp_image=cvCloneImage(orginal_image); if(true==g_isdown) { high_light(temp_image,g_rect); Draw_hist(temp_image,g_rect); } else { high_light(temp_image,g_rect); Draw_hist(temp_image,g_rect); } cvShowImage("Show",temp_image); if('q'==cvWaitKey(30)) { break; } } cvDestroyAllWindows(); return 0; }
void MySSGetFilter::ssgetAddFilter(int ssgetFlags, AcEdSelectionSetService &service, const AcDbObjectIdArray& selectionSet, const AcDbObjectIdArray& subSelectionSet) { if (m_color_index < 0) return; for (int i = 0; i < subSelectionSet.length(); ++i) { if (!canBeSelected(subSelectionSet[i])) { service.remove(i); continue; } if (!m_select_by_group) { high_light(subSelectionSet[i]); } else { } } }
void my_callback(int event,int x,int y,int flags,void* param) { IplImage* image=(IplImage*)param; switch(event) { case CV_EVENT_LBUTTONDOWN:{ g_isdown=true; g_rect=CvRect(x,y,0,0); } break; case CV_EVENT_MOUSEMOVE:{ if(true==g_isdown) { g_rect.width=x-g_rect.x; g_rect.height=y-g_rect.y; } } break; case CV_EVENT_LBUTTONUP:{ g_isdown=false; if(g_rect.width<0) { g_rect.x=g_rect.x+g_rect.width; g_rect.width*=-1; } if(g_rect.height<0) { g_rect.y=g_rect.y+g_rect.height; g_rect.height*=-1; } high_light(image,g_rect); Draw_hist(image,g_rect); } break; } }