PageRenderTime 132ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/VideoLoad/MYdisplay.cpp

https://github.com/straiki/VisionCup-Deep-Team
C++ | 56 lines | 47 code | 6 blank | 3 comment | 12 complexity | 9c78aae26ed6f16a6f936fadeb2eb5cf MD5 | raw file
  1. #include "MYdisplay.h"
  2. #include <iostream>
  3. MYdisplay::MYdisplay()
  4. {
  5. //ctor
  6. }
  7. MYdisplay::~MYdisplay()
  8. {
  9. //dtor
  10. }
  11. // bez odkliknuti
  12. char MYdisplay::ShowImage(IplImage * image, const char * winName, int x, int y){
  13. if( image != NULL){
  14. cvShowImage(winName, image);
  15. cvMoveWindow(winName, x, y);
  16. }
  17. }
  18. char MYdisplay::ShowImage(IplImage * image, char cvKey, const char * winName,int x, int y){
  19. if( image != NULL){
  20. cvShowImage(winName, image);
  21. cvMoveWindow(winName, x, y);
  22. if(cvKey == 0){
  23. cvWaitKey(0);
  24. return cvKey;
  25. }
  26. else if(cvKey == -1){
  27. return cvKey;
  28. }
  29. else{
  30. while(1){
  31. char keystroke = cvWaitKey();
  32. if( keystroke == cvKey){
  33. return cvKey;
  34. }
  35. }
  36. }
  37. }
  38. }
  39. void MYdisplay::DrawPoint(IplImage * image, CvPoint P, int delka, int tloustka, CvScalar barva){
  40. cvLine(image,cvPoint(P.x-delka,P.y),cvPoint(P.x+delka,P.y),barva,tloustka,8,0);
  41. cvLine(image,cvPoint(P.x,P.y-delka),cvPoint(P.x,P.y+delka),barva,tloustka,8,0);
  42. }
  43. int MYdisplay::LoadImage(IplImage** image,const char * imgPath){
  44. *image = cvLoadImage(imgPath);
  45. if(!image){
  46. std::cerr << "Nelze nacist obrazek";
  47. return 1;
  48. }
  49. return 0;
  50. }