Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h> //system commands
- #include <stdio.h>
- #include <ctime> //time
- #include <string> //Strings for file names
- #include <unistd.h> //sleep
- #include <cmath> //math
- using namespace std;
- using namespace cv;
- /** Function Headers */
- int getframes(string inFile);
- /**@function main */
- int main(int argc, char** argv) {
- string inFile = "";
- if (argc == 1){
- inFile = "aabb.gif";
- cout << "number of Farmes: " << getframes(inFile)<< endl;
- }
- if( argc == 2 ) {
- inFile = argv[1];
- cout << getframes(inFile) << endl;
- }
- if(argc >= 3){
- cout << "Usage: ./program InputFile \n \n This program converts gifs to png, that can be converted to gps srf files. \n";
- return 1;
- }
- return 0;
- }
- int getframes(string inFile){
- system("rm /dev/shm/neu"); //stores system command output until I can put it in a varible.
- system(("identify -format \"%n\n\" " +inFile+ "| head -1 > /dev/shm/neu").c_str());
- FILE* file = fopen ("/dev/shm/neu", "r");
- int i = 0;
- fscanf (file, "%d", &i);
- while (!feof (file)){
- fscanf (file, "%d", &i);
- }
- //cout << "Number of frames in the file are: " << i <<endl;
- fclose (file);
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement