IntroductionIt is often required to crop images manually fast for computer vision researchers to gather training and testing image sets, e.g., cropping faces in images. This simple multi-platform (Windows and Linux were verified) software helps you to clip images manually fast. What You Can Do
Table of Contents
DownloadWindows binary and source codes
Drag and Drop a folder (including pictures) or a picture or a video file on exe. You can also execute it on the command prompt. No installer is included for this simple software. PS. It may be required to install Microsoft Visual C++ 2005 SP1 Redistributable Package (if you have never installed this or Visual Studio 2005 itself). I am looking for how not to require users to install it. Not to use VC++ 2005? How to compile for Linux is written below. Application Usage(Windows) Drag and drop a folder or an image file or a video file on imageclipper.exe. (Windows and Linux) Execute as a command line tool. See Command Usage section too. Mouse UsageLeft (select) : Select or initialize a rectangle region. Keyboard Usages (save) : Save the selected region as an image.
Saved file formatThe clipped images are saved as <dirname>/imageclipper/<basename>_<rotation_degree>_<left_x>_<top_y>_<width>_<height>.png such as ../myimages/imageclipper/lena.jpg_0359_0109_0093_0065_0090.png where the original filename is ../myimages/lena.jpg. A directory named "imageclipper" is created under the image file's directory and cropped images are stored on there. This filename format can be configured via command line options. See Command Usage section. Experimental Feature (Continuous Color Region)You can choose a rectangular region surrounding a continuous color region. Middle or SHIFT + Left : Initialize the watershed marker. Drag it. You can use Right mouse and hotkeys to move or resize the watershed marker. Command UsageImageClipper - image clipping helper tool. You may make a batch file (Windows) or a shell script or an alias (Linux) to setup default values. Use of -i and -v rather than -f would be useful in that case. How to Compile on LinuxYou need to install OpenCV and Boost libraries. Install OpenCVDownload OpenCV source codes (.tar.gz) root user tar zxvf opencv-1.0.0.tar.gz; cd opencv-1.0.0 general user tar zxvf opencv-1.0.0.tar.gz; cd opencv-1.0.0 export PATH=$HOME/usr/bin/:$PATH Install Boostroot user and Red Hat (Fedora) yum install boost root user and Debian (Ubunts) apt-get install boost general user Download Boost source codes (.tar.gz) tar zxvf boost_1_36_0.tar.gz; cd boost_1_36_0 Reference: Boost Getting Started on Unix Variants CompileUnarchive imageclipper.zip. Go to src/ directory. A Makefile is attached. Modify as follows:
I don't know why boost library uses different names under different system. It requires us to modify Makefile as above in different system.... anyway, Finally make You should get an executable file "imageclipper". How to Compile on WindowsA binary file for Windows is already attached. This section explains how to compile for those who want to modify source codes and create a modified software. You need to install OpenCV and Boost libraries. Install OpenCVDownload OpenCV installer and install it. I assume you have installed onto C:\Program Files\OpenCV. Install BoostDownload boost installer and install it. I assume you have installed onto C:\Program Files\boost\boost_1_35_0. Reference: Boost Getting Started on Windows Setup MS Visual C++I write details based on MS Visual Studio 2005. Change boost_1_35_0 if your version is different. Follow menus of MS Visual C++ window as:
C:\Program Files\boost\boost_1_35_0\lib CompileUnarchive imageclipper.zip and open src\imageclipper.sln, then Build for Release. Creating a text file to locate clipped regionA text file containing locations of clipped region is sometimes required rather than clipped images themselves, e.g., as a ground truth text for testing experiments in computer vision. Assume there exist files as follows: $ \ls imageclipper/*_*_* By executing the following command, $ find imageclipper/*_*_* -exec basename \{\} \; | perl -pe \ you can obtain a text file "clipping.txt" as follows: image.jpg 68 47 89 101 I think this file format is a typical format for testing experiments in many computer vision tools. For OpenCV haartraing UsersUse haartrainingformat.pl as $ perl haartrainingformat.pl clipping.txt | tee info.dat where clipping.txt is the text file created at the previous section to create a OpenCV haartraining suitable format such as image.jpg 5 68 47 89 101 87 66 90 80 95 105 33 32 109 93 65 90 117 97 52 95 Or you can generate a file without creating "clipping.txt" as $ \ls imageclipper/*_*_* | perl haartrainingformat.pl --ls --trim --basename | tee info.dat Note that clipped images themselves are enough and better for training phase (See Tutorial: OpenCV haartraining). Therefore, you may use this only for creation of testing data. Usage Helper tool to convert a specific format into a haartraining format. |