When I try using this Command: opencv_createsamples -img image.jpg -bg bg.txt -info /info/info.lst -pngoutput info -num 2600 it tells me: Invalid background description file.
I now tried:
./neg/1.jpg
./net/2.jpg
Didn't work.
./neg/1.jpg
./neg/2.jpg
Didn't work as well.
neg/1.jpg
neg/2.jpg
Same problem
neg/1.jpg
neg/2.jpg
Also not working.
Any ideas?? I really need help.
Thanks
FritzFurtz
I had the same problem and tried many different things (adding full path names in the bg.txt, convert to UTF-8,...) - which resulted in getting slightly different looking errors - but still, no success. I am following this tutorial - and I am preparing all the files on my windows laptop & then pushing them to a ubuntu server.
Then I read it might be caused by difference in line ending (CLRF and LF) and checked my file (on the ubuntu server):
$ file bg.txt
bg.txt: UTF-8 Unicode (with BOM) text, with CRLF line terminators
I converted the file from dos2unix:
$ sudo apt install dos2unix
$ dos2unix bg.txt
dos2unix: converting file bg.txt to Unix format ...
$ file bg.txt
bg.txt: ASCII text
And now the opencv_createsamples command worked.
I was experiencing the same problem and it was very frustrating. But now it's solved.
1) CTRL + A ; CTRL + C; on your background description file to copy all it's content.
2) Create a new background description file (e.g.: bg2.txt), and CTRL + V to paste all the content you copied. Save it.
3) Run your command again, using, of course, the new bg description file (-bg bg2.txt).
It worked for me and might work for you.
Cheers,
Geraldo Neto
I had the exact same problem. I tried changing the bg.txt encoding and it made no difference. I deleted all instances of OpenCV on my Ubuntu server and rebooted. I typed:
git clone https://github.com/Itseez/opencv.git
into the terminal.
Once downloaded, rebooted the server and proceeded with:
opencv_createsamples -img image.jpg -bg bg.txt -info /info/info.lst -pngoutput info -num 1500
That seemed to fix my "Invalid background description file" error.
Bear in mind that I tried to create a new folder and add a fresh download of OpenCV to use on a separate project and it just copied my existing file.
Delete all instances of the OpenCV folder before rebooting and redownloading it!
I had this problem too and I solved it by changing encoding of my bg.txt to UTF-8. Also, my file looks like:
neg/1.jpg
neg/2.jpg
On Linux (Ubuntu) adding one more empty line doe snot work. File was in utf-8 encoding. Resolved with converting from "linux" to "dos" line ending format.
Related
I am able to do use the ImageMagick convert function on the command line with no problems:
/usr/local/magick/bin/convert a.pdf b.png
I then put it in a one-line PHP file named testconvert.php:
system("/usr/local/magick/bin/convert a.pdf b.png", $code);
and it works fine as a command line call from PHP:
php testconvert.php
But, when I run the script from my browser on localhost:
http://localhost/~me/testconvert.php
I get the error:
convert: no images defined `b.png' # error/convert.c/ConvertImageCommand/3253
I found a lot of folks who have encountered similar problems and fixes ranged from using the absolute path for the files (didn't help) to installing ghostscript (didn't help, either). I'm going a bit gaga with this. Would anyone have any thoughts about what I can possibly try?
Thanks!
Change your system() line to:
system("pwd");
and you will see which directory your script is running in.
I just downloaded ImageMagick but am not sure if it's working. I typed in 'which convert' into my terminal and nothing happened. I also tried typing in 'convert logo: logo.gif' then 'identify logo.gif' and lastly 'display logo.gif' and nothing seemed to happen (these three commands were specified on Windows).
Then I tried following this video: http://www.youtube.com/watch?v=gEWAVlNCKhg
However, it still didn't work and on the last step of the video. I got the following error: ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: ----with-opt-include=C:/ImageMagick/SourceCode
Can anyone advise on how to correctly install imagemagick on windows or what these errors mean?
That video has a bunch of unnecessary stuff if all you want to do is get ImageMagick working as a standalone product on Windows. All you need to do is:
Download latest Windows binary from imagemagick.org. Right now, that file is located here.
Run the installer (leave all default values the way they are)
Open a command prompt (Start --> Run --> cmd.exe)
Navigate to the ImageMagick folder in the command prompt window. For the default install path, this is done as follows :
Change to the root directory of the C: drive (type cd\ followed by the enter key)
Change to the ImageMagick folder (type cd "Program Files\ImageMagick-6.8.6-Q16" followed by the enter key)
Test that it's working with the convert command: convert images\logo.jpg logo.gif
Look at the directory listing and check the for a logo.gif file with the current time/datestamp (dir logo.gif, followed by enter key).
Note: when you run the convert command, there will not be any output to the command prompt unless you turn on the verbose flag e.g. (convert -verbose images\logo.jpg logo.gif)
I noticed that in my installation that there was not a 'display.exe', but there was an 'imdisplay.exe". I tried using imdisplay in a folder that had images, and it did not how a window. I double clicked imdisplay.exe in the installation folder, and windows came up, including all of the ones I tried to open on the command line. When I closed all of those windows and tried the command line again, it worked.
I am not sure where you are getting 'which convert' (I did not watch the video). I can see all of the exe files that are available in the installation folder. convert.exe is one of them, so in a regular cmd window (I do not know anything about Powershell GitShell), you can just type:
convert logo.png logo.jpg
or something like that.
I am attempting to install RVM through Cygwin, following this tutorial.
AFter creating the directory and cloning the git repository, I need to run ./osx_or_cygin_kick_off to begin the installation process.
This is the error message I am getting:
$ ./osx_or_cygwin_kick_off
./automation/rvm/rvm_install: line 2: $'\r': command not found
./automation/rvm/rvm_install: line 3: syntax error near unexpected token `$'\r''
'/automation/rvm/rvm_install: line 3: `install_rvm()
./automation/rvm/rvm_install_some_rubies: line 2: $'\r': command not found
./automation/rvm/rvm_install_some_rubies: line 3: syntax error near unexpected token `$'\r''
'/automation/rvm/rvm_install_some_rubies: line 3: `install_some_rubies()
I read somewhere that converting the files to unix format via doc2unix might solve the problem, but it is only creating more error messages.
Any suggestions?
Edit:
The problem is that some Cygwin git installations try to do magic linefeed handling. To fix git so it stops mangling line endings, run:
git config --global core.autocrlf false
Original answer made more generic after comment clarification:
The file contains CRLF (\r\n) end-line sequences, which is typical on Windows. Unix doesn't like it, though; Unix (and Cygwin) want just LF (\n). I'm guessing you cut-and-pasted that file, or downloaded it through some mechanism that appended Windows line endings.
To fix files in Cygwin:
tr -d '\r' <filename >filename.tmp
Check and make sure filename.tmp looks ok, then:
mv -f filename.tmp
Alternately, do a browser download and save (rather than cut and paste), or from the Cygwin shell, download using curl or wget.
In all of the above cases, you probably won't have an executable file (just readable). You can either make it executable with:
chmod 755 filename
Or run it through the shell explicitly:
sh filename
You'll run into this problem often if you use Windows editors to manipulate your Cygwin files. Editors inside Cygwin will be fine (e.g. Vim). Optionally, many free Windows editors support Unix line endings. Notepad++ is a good one with a Unix line-ending option.
I'm getting the following error in my development.log
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream28514-0 is not recognized by the 'identify' command.>
And i've googled about this error and i found out that many people have solved this by adding this line
Paperclip.options[:command_path] = "/usr/local/bin"
However, i still get the same error even after adding that line! I've tried everything possible!
Any help would be highly appreciated!
Regards,
Punit
The Paperclip.options[:command_path] setting is for the location of your ImageMagick executables (in this case identify). Try running which identify and setting the option to be the directory that is returned. If that command doesn't return anything, make sure that ImageMagick is properly installed.
Here is what worked for me...
I uninstalled the imagemagick that i installed from the official webpage.
I reinstalled it from sudo apt-get install imagemagick
then i did write Paperclip.options[:command_path] = "to/correct/path"
THE PROBLEM HERE WAS...
when i ran "which identify" it appearde that the path was "usr/local/bin/identify"
it means that we I was supposed to put as a path "usr/local/bin" as my path.
BUT IT DIDN'T WORKED!
I surprisingly found that i identify was also in the "usr/bin" path. So i changed:
"usr/local/bin" to "usr/bin"
And that was all!
It means that it cannot find ImageMagick's executable identify on the location you specified in Paperclip.options[:command_path] (in your case /usr/local/bin).
This is tipically caused by two reason:
It might be that you actually did not installed ImageMagick.
SOLUTION: install it:
For MAC: sudo port install ImageMagick (which installs the binary release)
For UBUNTU: sudo sudo apt-get install imagemagick
It might be that the location where you installed ImageMagick is not /usr/local/bin but something else.
SOLUTION: find where it is installed, or via the command:
which identify (in case that identify is in the current PATH, as it should be)
or via a raw find through the file system:
find / -name identify
Anyway, the usual location for those file in Ubuntu should be /usr/bin
There are two possible problems:
Image Magick is not installed or broken
Paperclip is not able to find Image Magick
Let's take them one at a time:
1. Check you have Image Magick installed and it is working
Type:
identify
at the command line, it should work. If it isn't found, or fails to work, install Image Magick. Did this fix it? If not, continue:
2. Help Paperclip find Image Magick
Type:
which identify
at the command line to get the path to the identify command. Now, in production.rb, add the following line to the configuration block:
Paperclip.options[:command_path] = "/usr/bin"
Restart your server. That should fix it.
usr/bin worked me (Fedora 14 core)
Try running the identify command in the command line and see if that gives you some error message. I found out that my server was missing some delegate libraries.
identify example.jpg
I'm getting the following error in my development.log
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream28514-0 is not recognized by the 'identify' command.>
And i've googled about this error and i found out that many people have solved this by adding this line
Paperclip.options[:command_path] = "/usr/local/bin"
However, i still get the same error even after adding that line! I've tried everything possible!
Any help would be highly appreciated!
Regards,
Punit
The Paperclip.options[:command_path] setting is for the location of your ImageMagick executables (in this case identify). Try running which identify and setting the option to be the directory that is returned. If that command doesn't return anything, make sure that ImageMagick is properly installed.
Here is what worked for me...
I uninstalled the imagemagick that i installed from the official webpage.
I reinstalled it from sudo apt-get install imagemagick
then i did write Paperclip.options[:command_path] = "to/correct/path"
THE PROBLEM HERE WAS...
when i ran "which identify" it appearde that the path was "usr/local/bin/identify"
it means that we I was supposed to put as a path "usr/local/bin" as my path.
BUT IT DIDN'T WORKED!
I surprisingly found that i identify was also in the "usr/bin" path. So i changed:
"usr/local/bin" to "usr/bin"
And that was all!
It means that it cannot find ImageMagick's executable identify on the location you specified in Paperclip.options[:command_path] (in your case /usr/local/bin).
This is tipically caused by two reason:
It might be that you actually did not installed ImageMagick.
SOLUTION: install it:
For MAC: sudo port install ImageMagick (which installs the binary release)
For UBUNTU: sudo sudo apt-get install imagemagick
It might be that the location where you installed ImageMagick is not /usr/local/bin but something else.
SOLUTION: find where it is installed, or via the command:
which identify (in case that identify is in the current PATH, as it should be)
or via a raw find through the file system:
find / -name identify
Anyway, the usual location for those file in Ubuntu should be /usr/bin
There are two possible problems:
Image Magick is not installed or broken
Paperclip is not able to find Image Magick
Let's take them one at a time:
1. Check you have Image Magick installed and it is working
Type:
identify
at the command line, it should work. If it isn't found, or fails to work, install Image Magick. Did this fix it? If not, continue:
2. Help Paperclip find Image Magick
Type:
which identify
at the command line to get the path to the identify command. Now, in production.rb, add the following line to the configuration block:
Paperclip.options[:command_path] = "/usr/bin"
Restart your server. That should fix it.
usr/bin worked me (Fedora 14 core)
Try running the identify command in the command line and see if that gives you some error message. I found out that my server was missing some delegate libraries.
identify example.jpg