My Video Player
|
#include <highgui.h>
#include <cv.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | Field_Area |
Structure to store the top-left and botton-right corner coordinates of various fields & buttons. More... | |
Macros | |
#define | sldr_btn_width 15 |
Default value for the Slider Button's width. More... | |
#define | sldr_height 10 |
Default value for the Slider Button's height. More... | |
#define | ctrl_pnl_height 200 |
Default value for Control Pannel's height. More... | |
#define | p_width 840 |
Width of the video player. More... | |
#define | scrn_height 480 |
Height of the video-display area. More... | |
#define | p_height ( scrn_height + sldr_height + ctrl_pnl_height ) |
Height of the video player. More... | |
#define | MOUSE_CALLBACK 0 |
Alias for function call made by the MOUSE's callback. More... | |
#define | OTHER_CALLS 1 |
Alias for function call made by any function other than MOUSE's callback or Textbox Editor's function. More... | |
#define | EDIT_CALLS 2 |
Alias for function call made by functions the edit the textboxes function. This is reserved for future. More... | |
#define | STATIC_TEXT 0 |
Alias for static-text field. More... | |
#define | EDIT_TEXT 1 |
Alias for text-box field. More... | |
#define | PLAY_BTN 0 |
Alias for play button. More... | |
#define | PAUSE_BTN 1 |
Alias for pause button. More... | |
#define | STOP_BTN 2 |
Alias for stop button. More... | |
#define | STEPUP_BTN 3 |
Alias for step-up button. More... | |
#define | STEPDOWN_BTN 4 |
Alias for step-down button. More... | |
#define | BTN_ACTIVE 0 |
Alias for an active button. More... | |
#define | BTN_INACTIVE 1 |
Alias for an inactive button. More... | |
Functions | |
void | resetField (IplImage *image, int text_type) |
Function to reset a given text field. More... | |
void | initialize_pnl (char *filename) |
Function to initialise the control pannel. More... | |
int | moveSlider (int pos, int call_from) |
Custome slider's callback function. More... | |
void | my_mouse_callback (int event, int x, int y, int flags, void *param) |
Mouse's callback function. More... | |
void | getButton (IplImage *image, int btn_type, int btn_state) |
Function to get a new button. More... | |
void | getSpectrumVert (IplImage *image, CvScalar color1, CvScalar color2) |
Function to vertically color a button. More... | |
void | getSpectrumHorz (IplImage *image, CvScalar color1, CvScalar color2) |
Function to horizontaly color a button. More... | |
void | draw_triangle (IplImage *image, CvScalar color) |
Function to draw a triangle on a given image. More... | |
void | draw_square (IplImage *image, CvScalar color) |
Function to draw a square on a given image. More... | |
void | draw_pause (IplImage *image, CvScalar color) |
Function to draw a pause symbol on a given image. More... | |
void | draw_stepup (IplImage *image, CvScalar color) |
Function to draw a step-up symbol on a given image. More... | |
void | draw_stepdown (IplImage *image, CvScalar color) |
Function to draw a step-down symbol on a given image. More... | |
void | fill_color (IplImage *image, CvScalar color) |
Function to fill a symbol with a given color. More... | |
void | change_status () |
Function to change the status message. More... | |
void | type_step (char c, int frame_val) |
Function to edit a textbox. More... | |
void | resetAllEdits () |
Function to reset all fields to their previous contents. More... | |
int | main (int argc, char **argv) |
Variables | |
CvCapture * | vid |
Pointer to CvCapture structure. More... | |
IplImage * | player |
Pointer to the main image. More... | |
IplImage * | pnl |
Pointer to the control-pannel sub-image. More... | |
IplImage * | slider |
Pointer to the slider-strip sub-image. More... | |
IplImage * | sldr_btn |
Pointer to the slider-button sub-image. More... | |
IplImage * | sldr_val |
Pointer to the slider-value static-text sub-image. More... | |
IplImage * | oslider |
Pointer to temporary slider-value static-text sub-image. More... | |
IplImage * | frame_area |
Pointer to the frame-area sub-image. More... | |
IplImage * | frame |
Pointer to the fetched frame sub-image. More... | |
IplImage * | old_frame |
Pointer to the previously fetched frame. More... | |
IplImage * | cur_frame_no |
Pointer to current frame number static-text. More... | |
IplImage * | fps_edit |
Pointer to FPS (Frames Per Second) static-text. More... | |
IplImage * | four_cc_edit |
Pointer to FOUR_CC static-text. More... | |
IplImage * | status_edit |
Pointer to "Status" static-text. More... | |
IplImage * | numFrames |
Pointer to Total Frames static-text. More... | |
IplImage * | step_edit |
Pointer to the Step textbox. More... | |
IplImage * | play_pause_btn |
Pointer to play/pause button area. More... | |
IplImage * | stop_btn |
Pointer to stop button area. More... | |
IplImage * | stepup_btn |
Pointer to step_up button area. More... | |
IplImage * | stepdown_btn |
Pointer to step_down button area. More... | |
int | sldr_start |
Indicates the starting position (frame number) of the slider. More... | |
int | sldr_maxval |
The maximum number of frames in the video. More... | |
int | step_val = 1 |
Step size. More... | |
char | line [20] |
Memory to hold any string temporarily. More... | |
char | edit_text [20] |
Memory to hold a textbox string temporarily. More... | |
char | status_line [15] |
Memory to hold the "status" string. More... | |
char | four_cc_str [4] |
Memory to hold the Four Character Code (FOUR_CC). More... | |
double | fps |
Frames per second. More... | |
long | fourcc_l |
Four Character Code. More... | |
char * | fourcc |
Four_CC temporary string. More... | |
int | blink_count = 0 |
Blinker count. More... | |
int | blink_max = 5 |
char | blink_char = '|' |
Threshold to toogle the blink_char. More... | |
Field_Area | play_pause_btn_area |
The blinking character, toogled with an underscore (_). More... | |
Field_Area | stop_btn_area |
Stop Button coordinates. More... | |
Field_Area | stepup_btn_area |
Step Up Button coordinates. More... | |
Field_Area | stepdown_btn_area |
Step Down Button coordinates. More... | |
Field_Area | fps_edit_area |
FPS static-text coordinates. More... | |
Field_Area | four_cc_edit_area |
FOUR_CC static-text coordinates. More... | |
Field_Area | status_edit_area |
Status string coordinates. More... | |
Field_Area | step_edit_area |
Step textbox coordinates. More... | |
bool | sldr_moving = false |
Ture when slider is moving. More... | |
bool | playing = false |
True when the video is being played. More... | |
bool | processing = false |
True when some processing is carried out. More... | |
bool | typing_step = false |
True when any textbox value is being edited. More... | |
bool | blinking = false |
True when blinking character is set. More... | |
CvScalar | red = cvScalar( 0, 0, 255 ) |
Red color. More... | |
CvScalar | green = cvScalar( 0, 255, 0 ) |
Green color. More... | |
CvScalar | blue = cvScalar( 255, 0, 0 ) |
Blue color. More... | |
CvScalar | black = cvScalar( 0, 0, 0 ) |
Black color. More... | |
CvScalar | white = cvScalar( 255, 255, 255 ) |
White color. More... | |
CvScalar | light_yellow = cvScalar( 242, 255, 255 ) |
Light Yellow color. More... | |
CvScalar | yellow = cvScalar( 0, 255, 255 ) |
Yellow color. More... | |
CvScalar | gray = cvScalar( 242, 242, 242 ) |
Gray color. More... | |
CvScalar | orange = cvScalar( 0, 242, 255 ) |
Orange color. More... | |
CvScalar | voilet = cvScalar( 255, 0, 127 ) |
Voilet color. More... | |
CvScalar | brown = cvScalar( 0, 0, 127 ) |
Brown color. More... | |
CvFont | font |
Normal font. More... | |
CvFont | font_italic |
Italic font. More... | |
CvFont | font_bold |
Bold font. More... | |
CvFont | font_bold_italic |
Bold Italic font. More... | |
int | font_face_italic = CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC |
Font face. More... | |
int | font_face = CV_FONT_HERSHEY_SIMPLEX |
Font face. More... | |
double | hscale = 0.5 |
Font's Horizontal Scale parameter. More... | |
double | vscale = 0.5 |
Font's Vertical Scale parameter. More... | |
double | shear = 0 |
Font's Shear parameter. More... | |
int | thickness = 1 |
Font's Thickness parameter. More... | |
int | line_type = 8 |
Font's Line-type parameter. More... | |
File containing the source code of this simple video player.
Definition in file video_player.c.
#define BTN_ACTIVE 0 |
Alias for an active button.
If this value is passed, then the button under consideration is active. Therefore, all the operations on the pressing the button will be possible.
Definition at line 140 of file video_player.c.
#define BTN_INACTIVE 1 |
Alias for an inactive button.
If this value is passed, then the button under consideration is inactive. Therefore, no operations will be possible on pressing this button i.e. the button's callback function will not be called. Currently, no buttons are inactive during any point of execution. This is reserved for future enhancements in the video player.
Definition at line 146 of file video_player.c.
#define ctrl_pnl_height 200 |
Default value for Control Pannel's height.
The control pannel is nothing but a sub-image. This value specifies the height of this sub-image. The width is same as that of the player ( the main image displayed on the screen ) width.
Definition at line 49 of file video_player.c.
#define EDIT_CALLS 2 |
Alias for function call made by functions the edit the textboxes function. This is reserved for future.
If this value is passed, then the function call is made by the functions editing the textboxes (for future use). Curretly, this value is meaningless.
Definition at line 89 of file video_player.c.
#define EDIT_TEXT 1 |
Alias for text-box field.
If this value is passed, then the text field under consideration is a text-box. Accordingly operations are to be carried out on this text field.
Definition at line 102 of file video_player.c.
#define MOUSE_CALLBACK 0 |
Alias for function call made by the MOUSE's callback.
If this value is passed, then the function call is made by the MOUSE'S callback function. Sometimes the information about the caller function is required. This alias is easy to remember & is therefore associated to the MOUSE's callback function.
Definition at line 77 of file video_player.c.
#define OTHER_CALLS 1 |
Alias for function call made by any function other than MOUSE's callback or Textbox Editor's function.
If this value is passed, then the function call is made by any function other than the MOUSE'S callback function or functions editing the textboxes (for future use). Curretly, this value specifies that the call is made from any function other than the MOUSE's callback function.
Definition at line 83 of file video_player.c.
#define p_height ( scrn_height + sldr_height + ctrl_pnl_height ) |
Height of the video player.
This value defines the height of the video player i.e. the main image. This height is the addition of the heights of display area, the slider height and the height of the control pannel.
Definition at line 69 of file video_player.c.
#define p_width 840 |
Width of the video player.
This value defines the width of the main image ( player ) displayed on the screen. Various areas like the area of the video being displayed, the different textboxes, etc are actually sub-images of this main image.
Definition at line 56 of file video_player.c.
#define PAUSE_BTN 1 |
Alias for pause button.
If this value is passed, then the button under consideration is pause-button. Accordingly operations are to be carried out on the button area.
Definition at line 115 of file video_player.c.
#define PLAY_BTN 0 |
Alias for play button.
If this value is passed, then the button under consideration is play-button. Accordingly operations are to be carried out on the button area.
Definition at line 109 of file video_player.c.
#define scrn_height 480 |
Height of the video-display area.
This value defines the height of the video-display area. This is the area where the actual video frame is displayed. For convinence, every video frame is scaled to before being displayed.
Definition at line 62 of file video_player.c.
#define sldr_btn_width 15 |
Default value for the Slider Button's width.
The slider button's width is set using this value.
Definition at line 37 of file video_player.c.
#define sldr_height 10 |
Default value for the Slider Button's height.
The slider button's height is set using this value.
Definition at line 43 of file video_player.c.
#define STATIC_TEXT 0 |
Alias for static-text field.
If this value is passed, then the text field under consideration is static-text. Accordingly operations are to be carried out on this text field.
Definition at line 96 of file video_player.c.
#define STEPDOWN_BTN 4 |
Alias for step-down button.
If this value is passed, then the button under consideration is step-down button. Accordingly operations are to be carried out on the button area.
Definition at line 133 of file video_player.c.
#define STEPUP_BTN 3 |
Alias for step-up button.
If this value is passed, then the button under consideration is step-up button. Accordingly operations are to be carried out on the button area.
Definition at line 127 of file video_player.c.
#define STOP_BTN 2 |
Alias for stop button.
If this value is passed, then the button under consideration is stop-button. Accordingly operations are to be carried out on the button area.
Definition at line 121 of file video_player.c.
void change_status | ( | ) |
Function to change the status message.
Definition at line 1405 of file video_player.c.
void draw_pause | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to draw a pause symbol on a given image.
Function to draw a two parallel rectangles for the pause button. We pass the sub-image where we want to create the pause button and also pass the color which we desire of the button. We first define 2 points for the first rectangle whose coordinates are stored in pt1 and pt2 and a line between these points would be a vertical line. Now we simply draw 5 lines parallel to this line for the first rectangle and also 5 parallel lines for the second rectangle
image | : The image where we want to place the pause-rectangles |
color | : The desired color |
Definition at line 1305 of file video_player.c.
void draw_square | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to draw a square on a given image.
Function to draw a square for the stop button. We pass the sub-image where we want to create the stop button and also pass the color which we desire of the button. We first define 4 points for the square whose coordinates are stored in pt1, pt2, pt3 and pt4. Now we simply draw segments to connect these points and finally fill up the square with the desired color.
image | : The image where we want to place the stop-square |
color | : The desired color |
Definition at line 1285 of file video_player.c.
void draw_stepdown | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to draw a step-down symbol on a given image.
Definition at line 1382 of file video_player.c.
void draw_stepup | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to draw a step-up symbol on a given image.
Definition at line 1359 of file video_player.c.
void draw_triangle | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to draw a triangle on a given image.
Function to draw a triangle for the play button. We pass the sub-image where we want to create the play button and also pass the color which we desire of the button. We first define 3 points for the triangle whose coordinates are stored in pt1, pt2 and pt3. Now we simply draw segments to connect these points and finally fill up the triangle with the desired color.
image | : The image where we want to place the play-triangle |
color | : The desired color |
Definition at line 1261 of file video_player.c.
void fill_color | ( | IplImage * | image, |
CvScalar | color | ||
) |
Function to fill a symbol with a given color.
Definition at line 1331 of file video_player.c.
void getButton | ( | IplImage * | image, |
int | btn_type, | ||
int | btn_state | ||
) |
Function to get a new button.
Function to get the desired control button, say play, pause, stop, stepup, stepdown. The buttons are nothing but sub-images.
image | : This is the sub-image for the desired button. |
btn_type | : Can be any of the following viz. PLAY_BTN, PAUSE_BTN, STOP_BTN, STEPUP_BTN, STEPDOWN_BTN. |
btn_state | : Can be either BTN_ACTIVE or BTN_INACTIVE. For the time being, only BTN_ACTIVE is used and it is meaningless to pass BTN_INACTIVE. |
Definition at line 991 of file video_player.c.
void getSpectrumHorz | ( | IplImage * | image, |
CvScalar | color1, | ||
CvScalar | color2 | ||
) |
Function to horizontaly color a button.
This function is nothing by an implementation of linear interploation horizontally i.e. The color1 is the color of the leftmost row of the sub-image (image) and color2 is the color of the rightmost row of the sub-image. The intermediate colors are calculated using the following formula.
where,
X : color of the pixel to be determined.
B : Color of the rightmost row.
A : Color of the leftmost row.
l : Distance of the current pixel from the left (i.e. column number).
L : Total number of columns.
image | : The input sub-image for the button to be colored. |
color1 | : Color of the leftmost row. |
color2 | : Color of the rightmost row. |
Definition at line 1084 of file video_player.c.
void getSpectrumVert | ( | IplImage * | image, |
CvScalar | color1, | ||
CvScalar | color2 | ||
) |
Function to vertically color a button.
This function is nothing by an implementation of linear interploation vertically i.e. The color1 is the color of the topmost row of the sub-image (image) and color2 is the color of the bottom most row of the sub-image. The intermediate colors are calculated using the following formula.
where,
X : color of the pixel to be determined.
B : Color of the bottommost row.
A : Color of the topmost row.
l : Distance of the current pixel from the top (i.e. row number).
L : Total number of rows.
image | : The input sub-image for the button to be colored. |
color1 | : Color of the topmost row. |
color2 | : Color of the bottommost row. |
Definition at line 1029 of file video_player.c.
void initialize_pnl | ( | char * | filename | ) |
Function to initialise the control pannel.
This function is for initializing the control pannel, adding textfields, text and buttons to it. One may learn how to create a sub-image from an existing IplImage. Each sub-image can act as an independent image. The advantage of using sub-image over ROI is that multiple parts of an image can be worked upon simultaneously. You will come to know the importance of sub-image in the following where you will see how text-boxes and buttons are created with the use of sub-images. Lets's start.
In the initial lines you will come across the cvPutText() function. This is used to place text at various parts of the control pannel sub-image. Next you come across are the row and col. These are the starting coordinates where you want to place the textfields or buttons. To create such fields and buttons (which are nothing but sub-images of the control pannel, which is again a sub-image of the video-player), declare the IplImage header using cvCreateImageHeader() using the required dimensions. This will only create the image header and no data is assigned to it. To use this as a sub-image we need to need to make the following assignments.
Now the sub-image can be used as if it were an independent image. Further, for a few operations we need to keep a track of the coordinates of this newly created image. We store them in Field_Area structure of the respective button or text-field using the naming convention as sub_image_area. If the sub-image is a text-field then resetField() function is called. If the sub-image is a button then getButton() function is called.
filename | : The absolute path of the video file to be played. |
Definition at line 1122 of file video_player.c.
int main | ( | int | argc, |
char ** | argv | ||
) |
The main function creates the main image and various sub-images that constitute the video player. Once this outline is ready, frames from the video are fetched and displayed on the sub-image denoting the "screen area". Simultaneously, contents of other sub-image (frame number, slider position) are also updated.
Before starting to initialize the various sub-images, the fonts to be used need to be initialized. The fonts are initialized using the cvInitFont() function.
This is followed by the creation of an empty image (which serves as the main image of the player). The player image is created using the various dimensions shown earlier.
Then the control-pannel sub-image is assigned as a part of the main player image.
All the buttons, textboxes, static-texts, etc are initialized.
Above the control-pannel, a sub-image is assigned to be a slider. OpenCV has an inbuilt function cvCreateTrackbar() to create a slider. But the disadvantage with this function is, the slider is placed at either at the top or the buttom of an image in a window. Therefore, to have the slider at a custom location in the window, I created my own slider. Practically, this slider is a sub-image to which I have assigned a mouse_callback function. Setting the ROI to this sub-image was possible, but then simultaneously accessing all the sub-images would not had been possible. Therefore, the slider sub-image is created by first creating the sub-image of the required dimensions and then setting the origin, widthstep to be the same as that of the main image and the imageData to the appropriate value of imageData of the main image. Everytime the slider position is updated, the original slider needs to be restored first and then the new position is to be marked. Therefore, the original slider sub-image is cloned to oslider sub-image. sldr_val sub-image is nothing but a rectangular image at a position derived from the slider's value. Thus, every time the slider's value is updated, the original slider sub-image ( oslider ) is restored, followed by placing the sldr_val sub-image at it appropriate position on the slider.
The main player images needs to be displayed using a Named Window. Using the cvNamedWindow() function we create a display window.
Everytime a mouse action ( move, click, etc ) occurs on the main display window, the events need to be captured and appropriate actions are to be called. For achieveing this task the cvSetMouseCallback() function is used.
Now that we are ready with the video-player's outline, the video file should be loaded. This is achieved using the cvCaptureFromFile() function. The next task is to access various properties of this video and then display them at appropriate locations on the Control Pannel. To access the video properites cvGetCaptureProperty() function is used.
If proper codecs are installed and the video consists of atleast one frame, then cvQueryFrame() should return the initial frame in the video. If no frame is returned then there must be some problem either with the codecs or the video itself. In such a case, the program is halted with an appropriate error message. If everything goes fine, then the currently grabbed frame is stored into old_frame.
Now we come to the task where a frame is grabbed and displayed on the screen. If the player is in play mode ( i.e. player is set to true ) then frames are grabbed sequentially at an interval derived from the FPS value. The grabbed frame is then resized to the screen_area and displayed to the viewes.
Finally, cleaning up is done by destroying all the open windows and releasing all the images and sub-images.
argv[1] | : Video file path |
0 | Exit without any problem. |
1 | Early exit with due to some error. |
Definition at line 505 of file video_player.c.
int moveSlider | ( | int | pos, |
int | call_from | ||
) |
Custome slider's callback function.
Whenever a right-click on our custom-built slider occurs and the mouse is moved over the slider or there is a change in the displayed frame, this function is called.
If the function is called from a mouse event then call_from is set to MOUSE_CALLBACK and corresponding pos indicates the x-coordinate (Cartesian System) of the latest mouse event. The current frame value ( frame_val ) is derived from pos using appropriate scaling.
If this function is called from any other function then call_from is set to OTHER_CALLS and corresponding pos indicates the current frame value which is directly assigned to frame_val.
Again scaling is done so that the slider button can be set to an appropriate location between 0 and (p_width - sldr_btn_width)
Proper care is taken so that frame_val remains an integeral multiple of step_val between 0 and sldr_maxval.
Current frame number is then updated in the control pannel and lastly the slider button is set at its appropriate location on the custom-built slider.
pos | Either the x-coordinate of the latest mouse event on the slider or the current frame number. |
call_from | Set to MOUSE_CALLBACK when this function is called from a mouse callback event, else set to OTHER_CALLS. |
Definition at line 729 of file video_player.c.
void my_mouse_callback | ( | int | event, |
int | x, | ||
int | y, | ||
int | flags, | ||
void * | param | ||
) |
Mouse's callback function.
The function is callback for mouse events. Actions to be taken for various mouse events are defined in this function. This function is the 2nd argument to the cvSetMouseCallback() function.
We associate this mouse callback function for events on the custom-built slider as well as on the different fields in the control pannel. Following is the explaination of the various mouse events used in this scenario and their respective actions.
Case1, event = CV_EVENT_MOUSEMOVE i.e. mouse is moved. If the slider button is dragged to a different location, only then this mouse event is to be used to update the frame being displayed. So both conditions viz. the slider is moving ( sldr_moving ) an the mouse coordinates belong to the custom-built slider are checked and accordingly the new frame number is calculated which is also updated in various fields of the player.
Case2, event = CV_EVENT_LBUTTONDOWN i.e. mouse's left button is pressed down. This event indicates some button being pressed ( play, pause, etc or slider button ). The mouse coordinates help to identify the button being pressed. Approproate actions on pressing respective buttons are taken.
Case3, event = CV_EVENT_LBUTTONUP i.e. mouse's left button is released after earlier press. Only the slider-button depends on this event it can be dragged along the slider-strip. Therefore, on this event the slider movement is stopped.
event | |
x | |
y | |
flags | |
param |
Definition at line 784 of file video_player.c.
void resetAllEdits | ( | ) |
Function to reset all fields to their previous contents.
Definition at line 1466 of file video_player.c.
void resetField | ( | IplImage * | image, |
int | text_type | ||
) |
Function to reset a given text field.
This function will reset a text-field ( a textbox or a static text). The text-field is nothing but a sub-image. Therefore all the pixel values are to be reset to the original values of the respecitve text fields (white with black border for EDIT_TEXT and Control Pannel's color with black border for STATIC_TEXT).
Whenever the value in the text-field is changed, the text-field being an image, the new value is overwritten over the old value. Therefore, every time a new value is to be written, the respective field need to be reset.
image | : The sub-image (i.e. the text-field) to be reset. |
text_type | : Either STATIC_TEXT or EDIT_TEXT. |
Definition at line 952 of file video_player.c.
void type_step | ( | char | c, |
int | frame_val | ||
) |
Function to edit a textbox.
Definition at line 1411 of file video_player.c.
CvScalar black = cvScalar( 0, 0, 0 ) |
Black color.
Definition at line 426 of file video_player.c.
char blink_char = '|' |
Threshold to toogle the blink_char.
Definition at line 403 of file video_player.c.
int blink_count = 0 |
Blinker count.
This counter is used to toogle the blinker character blink_char. Whenever this counter crosses blink_max, the blink_char is toogled.
Definition at line 400 of file video_player.c.
int blink_max = 5 |
Definition at line 402 of file video_player.c.
bool blinking = false |
True when blinking character is set.
Definition at line 419 of file video_player.c.
CvScalar blue = cvScalar( 255, 0, 0 ) |
Blue color.
Definition at line 425 of file video_player.c.
CvScalar brown = cvScalar( 0, 0, 127 ) |
Brown color.
Definition at line 433 of file video_player.c.
IplImage* cur_frame_no |
Pointer to current frame number static-text.
Points to the sub-image showing the current frame number.
Definition at line 281 of file video_player.c.
char edit_text[20] |
Memory to hold a textbox string temporarily.
This will hold a textbox string temporarily. Whenever a textbox is to be used, the original string in the textbox is required while editing its contents. This is the primary use of this memory.
Definition at line 372 of file video_player.c.
CvFont font |
Normal font.
Definition at line 436 of file video_player.c.
CvFont font_bold |
Bold font.
Definition at line 438 of file video_player.c.
CvFont font_bold_italic |
Bold Italic font.
Definition at line 439 of file video_player.c.
int font_face = CV_FONT_HERSHEY_SIMPLEX |
Font face.
Definition at line 441 of file video_player.c.
int font_face_italic = CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC |
Font face.
Definition at line 440 of file video_player.c.
CvFont font_italic |
Italic font.
Definition at line 437 of file video_player.c.
IplImage* four_cc_edit |
Pointer to FOUR_CC static-text.
Points to the sub-image showing FOUR_CC static text.
Definition at line 297 of file video_player.c.
Field_Area four_cc_edit_area |
FOUR_CC static-text coordinates.
Definition at line 410 of file video_player.c.
char four_cc_str[4] |
Memory to hold the Four Character Code (FOUR_CC).
Definition at line 375 of file video_player.c.
char* fourcc |
Four_CC temporary string.
An intermediate string to hold the FOUR_CC value while parsing from fourcc_l to four_cc_str.
Definition at line 392 of file video_player.c.
long fourcc_l |
Four Character Code.
Hold the FOUR_CC value in double format. This value is directly read from the input video file, parsed to a string (using fourcc) and stored to four_cc_str.
Definition at line 387 of file video_player.c.
double fps |
Frames per second.
Frames Per Second value is stored in this variable. This value is read from the input video file.
Definition at line 381 of file video_player.c.
IplImage* fps_edit |
Pointer to FPS (Frames Per Second) static-text.
Points to the sub-image showing the FPS. This is currently a static-text field and its value is to be loaded from the video initially. Later, the functionality to edit this field can be added, therefore the pointer has "edit" in its name. It hold the value of fps.
Definition at line 289 of file video_player.c.
Field_Area fps_edit_area |
FPS static-text coordinates.
Definition at line 409 of file video_player.c.
IplImage* frame |
Pointer to the fetched frame sub-image.
This will point to frame fetched using cvQueryFrame(). Therefore, this pointer is only declared and not defined. The allocation and deallocation of memory pointed by this pointer is handled by cvQueryFrame().
Definition at line 266 of file video_player.c.
IplImage* frame_area |
Pointer to the frame-area sub-image.
The frame-area sub-image is originally created as an empty image using the cvCreateImage() function. Here the currently fetched frame will be displayed. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this Frame-area sub-image, will be reflected directly on the screen.
Definition at line 258 of file video_player.c.
CvScalar gray = cvScalar( 242, 242, 242 ) |
Gray color.
Definition at line 430 of file video_player.c.
CvScalar green = cvScalar( 0, 255, 0 ) |
Green color.
Definition at line 424 of file video_player.c.
double hscale = 0.5 |
Font's Horizontal Scale parameter.
Definition at line 442 of file video_player.c.
CvScalar light_yellow = cvScalar( 242, 255, 255 ) |
Light Yellow color.
Definition at line 428 of file video_player.c.
char line[20] |
Memory to hold any string temporarily.
Definition at line 366 of file video_player.c.
int line_type = 8 |
Font's Line-type parameter.
Definition at line 446 of file video_player.c.
IplImage* numFrames |
Pointer to Total Frames static-text.
Points to the sub-image showing the Total Number of Frames static-text. It holds the value of sldr_maxval.
Definition at line 313 of file video_player.c.
IplImage* old_frame |
Pointer to the previously fetched frame.
The current fetched frame using cvQueryFrame() is cloned to old_frame before fetching the next frame. Thus, this pointer points to an IplImage structure holding the previously fetched frame.
Definition at line 274 of file video_player.c.
CvScalar orange = cvScalar( 0, 242, 255 ) |
Orange color.
Definition at line 431 of file video_player.c.
IplImage* oslider |
Pointer to temporary slider-value static-text sub-image.
The temporary slider-value static-text sub-image is originally created as an empty image using the cvCreateImage() function. This is used to temporarily store the original slider-value. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this temporary slider-value static-text sub-image, will be reflected directly on the screen.
Definition at line 244 of file video_player.c.
IplImage* play_pause_btn |
Pointer to play/pause button area.
Points to the sub-image having the play / pause button.
Definition at line 330 of file video_player.c.
Field_Area play_pause_btn_area |
The blinking character, toogled with an underscore (_).
Play / Pause Button coordinates.
Definition at line 405 of file video_player.c.
IplImage* player |
Pointer to the main image.
Pointer to the main image shown on the screen. The various buttons, screen-area etc are sub-images of this image. Initially this image is created as an empty image using the cvCreateImage() function. Later, every sub-image's data part is assigned the desired part of this main image. Now, any further operation on the sub-images reflects the change in this image as well.
Definition at line 174 of file video_player.c.
bool playing = false |
True when the video is being played.
Definition at line 416 of file video_player.c.
IplImage* pnl |
Pointer to the control-pannel sub-image.
The control-pannel sub-image is originally created as an empty image using the cvCreateImage() function. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this Control-Pannel sub-image, will be reflected directly on the screen.
Definition at line 188 of file video_player.c.
bool processing = false |
True when some processing is carried out.
Definition at line 417 of file video_player.c.
CvScalar red = cvScalar( 0, 0, 255 ) |
Red color.
Definition at line 423 of file video_player.c.
double shear = 0 |
Font's Shear parameter.
Definition at line 444 of file video_player.c.
IplImage* sldr_btn |
Pointer to the slider-button sub-image.
The slider-button sub-image is originally created as an empty image using the cvCreateImage() function. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this Slider-Button sub-image, will be reflected directly on the screen.
Definition at line 216 of file video_player.c.
int sldr_maxval |
The maximum number of frames in the video.
Definition at line 358 of file video_player.c.
bool sldr_moving = false |
Ture when slider is moving.
Definition at line 415 of file video_player.c.
int sldr_start |
Indicates the starting position (frame number) of the slider.
Definition at line 357 of file video_player.c.
IplImage* sldr_val |
Pointer to the slider-value static-text sub-image.
The slider-value static-text sub-image is originally created as an empty image using the cvCreateImage() function. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this Slider-value Static-Text sub-image, will be reflected directly on the screen.
Definition at line 230 of file video_player.c.
IplImage* slider |
Pointer to the slider-strip sub-image.
The slider-strip sub-image is originally created as an empty image using the cvCreateImage() function. It is then assigned the following properties of the main image so that it becomes a sub-image ( or region of interest ).
Once this assignment is done, any change in this Slider-strip sub-image, will be reflected directly on the screen.
Definition at line 202 of file video_player.c.
IplImage* status_edit |
Pointer to "Status" static-text.
Points to the sub-image showing the status static-text. Holds the string in status_line.
Definition at line 305 of file video_player.c.
Field_Area status_edit_area |
Status string coordinates.
Definition at line 411 of file video_player.c.
char status_line[15] |
Memory to hold the "status" string.
Definition at line 374 of file video_player.c.
IplImage* step_edit |
Pointer to the Step textbox.
Points to the sub-image showing the Step textbox. This will hold the value of step_val.
Definition at line 321 of file video_player.c.
Field_Area step_edit_area |
Step textbox coordinates.
Definition at line 412 of file video_player.c.
int step_val = 1 |
Step size.
The step size is the distance between the current and the next frame to be fetched. To view the video as it is, every frame has to be displayed. Therefore, by default this value is set to 1.
Definition at line 364 of file video_player.c.
IplImage* stepdown_btn |
Pointer to step_down button area.
Points to the sub-image having the step_down button.
Definition at line 354 of file video_player.c.
Field_Area stepdown_btn_area |
Step Down Button coordinates.
Definition at line 408 of file video_player.c.
IplImage* stepup_btn |
Pointer to step_up button area.
Points to the sub-image having the step_up button.
Definition at line 346 of file video_player.c.
Field_Area stepup_btn_area |
Step Up Button coordinates.
Definition at line 407 of file video_player.c.
IplImage* stop_btn |
Pointer to stop button area.
Points to the sub-image having the stop button.
Definition at line 338 of file video_player.c.
Field_Area stop_btn_area |
Stop Button coordinates.
Definition at line 406 of file video_player.c.
int thickness = 1 |
Font's Thickness parameter.
Definition at line 445 of file video_player.c.
bool typing_step = false |
True when any textbox value is being edited.
Definition at line 418 of file video_player.c.
CvCapture* vid |
Pointer to CvCapture structure.
A global pointer to the CvCapture structure is created so that the capture properties can be extracted and edited seamlessly from any of the related functions. CvCapture is basically used to capture the video into the program using the functions cvCaptureFromFile() (for capturing from file) or cvCaptureFromCAM() (for capturing directly from the attached camera). The details of CvCapture structure can be found here.
Definition at line 166 of file video_player.c.
CvScalar voilet = cvScalar( 255, 0, 127 ) |
Voilet color.
Definition at line 432 of file video_player.c.
double vscale = 0.5 |
Font's Vertical Scale parameter.
Definition at line 443 of file video_player.c.
CvScalar white = cvScalar( 255, 255, 255 ) |
White color.
Definition at line 427 of file video_player.c.
CvScalar yellow = cvScalar( 0, 255, 255 ) |
Yellow color.
Definition at line 429 of file video_player.c.