Octave memory allocation error after changing graphicsmagicks to quantum depth 16 - image-processing

I tried to increase the quantum depth of the GraphicsMagick to 16bits. I downloaded the GraphicsMagick package from here. Here is the result for the version details and quantum depth result for gm version.
karthikeyan#karthikeyan:~$ gm version
GraphicsMagick 1.3.25 2016-09-05 Q16 http://www.GraphicsMagick.org/
Copyright (C) 2002-2016 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
..
...
....
Configured using the command:
./configure '--with-quantum-depth=16' '--enable-shared' '--disable-static' '--with-magick-plus-plus=yes'
So I went ahead to process images,assuming my graphicsmagick can handle 16 bits, but I am getting this error. Please help to resolve this:
karthikeyan#karthikeyan:~$ octave
octave:1> i = imread("/home/karthikeyan/Pictures/Wallpapers/f1376677896.jpg");
warning: your version of GraphicsMagick limits images to 8 bits per pixel
*** Error in `/usr/bin/octave-cli': malloc(): memory corruption: 0x0000000002300dd0 ***
panic: Aborted -- stopping myself...
^C^CPress Control-C again to abort.
^Cpanic: attempted clean up apparently failed -- aborting...
Aborted (core dumped)

Related

Problem compiling bitcoin source code(https://github.com/bitcoin/bitcoin) on linux

Issue: Problem compiling bitcoin source code from https://github.com/bitcoin/bitcoin
Building bitcoin code requires Berkeley DB 4.8( https://github.com/tinybike/get-bdb-4.8).
No problem with that.
My system is running on Ubuntu 20.04.
$ cpp --version
cpp (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
When compiling the bitcoin code, after running 'configure' and 'make' an error occurs indicating that it could not find iostream.h
...
CXX libbitcoin_server_a-txrequest.o
CXX libbitcoin_server_a-txmempool.o
CXX libbitcoin_server_a-validation.o
CXX libbitcoin_server_a-validationinterface.o
CXX libbitcoin_server_a-versionbits.o
CXX wallet/libbitcoin_server_a-init.o
In file included from ./wallet/bdb.h:27,
from wallet/init.cpp:19:
/bitcoin/src/bdb/build_unix/build/include/db_cxx.h:59:10: fatal error: iostream.h: No such file or directory
59 | #include <iostream.h>
| ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:8933: wallet/libbitcoin_server_a-init.o] Error 1
make[2]: Leaving directory '/bitcoin/src'
make[1]: *** [Makefile:15214: all-recursive] Error 1
make[1]: Leaving directory '/bitcoin/src'
make: *** [Makefile:809: all-recursive] Error 1
On examining the header files location /usr/include/c++/9 I could not locate iostream.h
Is this a compiler package issue or bitcoin not using c++ iostream header file
I would guess you tried to build the "depends" BDB before installing the required system packages, and that produced an invalid/unusuable build.
Try removing your current "depends" builds and doing them over.
Alternatively, you could just use my db48 PPA for Ubuntu: https://launchpad.net/~luke-jr/+archive/ubuntu/db48
i got the same error,but it came when i build zero-ice with berkeley db. I found some usages about libdb and most of them add #define HAVE_CXX_STDHEADERS at the begining of codes, so i tried add this definition in ICEDIR/cpp/include/IceUtil/Config.h. It works.Wish it works for you.
something was completely wrong during db4.8 compilation
but as temporary fix, you may add in
include/db_cxx.h
#define HAVE_CXX_STDHEADERS 1
this may help, but depends.
imho
most correct way to build db-4.8 for bitcoin
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar zxvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC
build_unix/
../dist/configure --prefix=/usr/local/db48 --enable-cxx --with-pic --disable-replication --disable-shared
make install
cd ../bitcoin-x.x
export BDB_PREFIX=/usr/local/db48
export BDB_LIBS="-L/usr/local/db48/lib -ldb_cxx-4.8"
export BDB_CFLAGS="-I/usr/local/db48/include"
./configure
and etc.

ImageMagick convert OOMing inside Singularity container

When I run a specific ImageMagick convert command (to produce an animated GIF) inside a Singularity container it is consistently giving an memory error:
convert-im6.q16: cache resources exhausted `foo.gif' # error/cache.c/OpenPixelCache/4083.
convert-im6.q16: memory allocation failed `foo.gif' # error/quantize.c/AssignImageColors/496.
How can I debug this?
I'm not getting any memory issues outside of Singularity which gives me the impression that either Singularity is artificially limiting my available memory or ImageMagick is configured poorly inside of Singularity. I am not seeing memory issues for any of my other applications running inside Singularity which makes me think it's an ImageMagick issue.
Here are some details about my system:
$ singularity --version
singularity version 3.7.1-1.el8
Inside the container:
Singularity> convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
and
Singularity> convert -list resource
Resource limits:
Width: 16KP
Height: 16KP
List length: 18.446744EP
Area: 128MP
Memory: 256MiB
Map: 512MiB
Disk: 1GiB
File: 768
Thread: 256
Throttle: 0
Time: unlimited
The Memory: 256MiB stands out as especially low. I should have at least 2GiB. How does ImageMagick configure these limits and how can I change them?
The problem turned out to be with ImageMagick's system-wide policy.xml that was installed in my container. Updating that file with more generous "memory" and "disk" values fixed this problem.
You can find the location of your system's policy.xml file using the command convert -list policy (Hat tip to Kurt Pfeifle's answer which clued me in on this). For me it was at /etc/ImageMagick-6/policy.xml. You can edit that file
(if you have root access). In the end I decided just to delete the file since I don't want my system from restricting my use at all inside the container.
You can set limits via the command line, say convert -limit memory 2GiB ... or environment variables (See Kurt Pfeifle's answer for details). However, this method does not allow expanding larger than system-wide limits set in policy.xml because this policy file is meant to be a way for system administrators to forcibly limit users. Therefore, the only way to remedy this is to update/remove the system-wide policy.

How to keep Tesseract from inserting extra whitespace in words?

I asked about this on the Tesseract forum already
Via Tesseract (and ImageMagick), I'm trying to find out the text of this
PDF file
This is the section of the PDF that I'm working on, it's line #7 of the
PDF:
In this section, Tesseract is running into problems when trying to identify
the string CONSTRUCTORA.
It sees CO NSTRUCTO RA
It should see CONSTRUCTORA
Can anyone suggest any possible fixes for this?
This is the commandline sequence:
convert -density 600 my_pdf.pdf tmp.tif
tesseract -l spa tmp.tif stdout > tmp.txt
These are the software versions:
~% tesseract --version
tesseract 3.05.01
leptonica-1.74.4
libgif 4.1.6(?) : libjpeg 8d (libjpeg-turbo 1.3.0) : libpng 1.2.50 :
libtiff 4.0.3 : zlib 1.2.8
~% convert --version
Version: ImageMagick 6.7.7-10 2014-08-28 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
For dealing with the irregular kerning of the PDF file, Will suggested tweaking the parameters around tosp_min_sane_kn_sp of the docs https://github.com/naptha/tesseract.js/blob/master/docs/tesseract_parameters.md
Setting tosp_min_sane_kn_sp=2.8 solved the issue that was described in the question.
The new Tesseract invocation is the following:
tesseract -c tosp_min_sane_kn_sp=2.8 -l spa tmp.tif stdout > tmp.txt
The default value for tosp_min_sane_kn_sp seems to be 1.5. So far, I have only tested with values larger than 1.5.

can't install this file (mercury6_2.for) with gfortran

I tried this:
Alan#Alan ~/mercury
$ gfortran -o mercury6_2.for
gfortran.exe: fatal error: no input files; unwilling to write output files
compilation terminated
and:
Alan#Alan ~/mercury
$ gfortran -o mercury mercury6_2.for
gfortran.exe: error: CreateProcess: No such file or directory
My file exist:
Alan#Alan ~/mercury
$ ls
big.in element.in mercury.inc mercury6_2.for README.txt
close.in element6.for mercury6.man message.in small.in
close6.for files.in mercury6.tar param.in swift.incenter code here
gfortran seems to be running in Cygwin:
Alan#Alan ~/mercury
$ gfortran --version
GNU Fortran (GCC) 4.8.0 20130302 (experimental) [trunk revision 196403]
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
So I don't know.
Is there away that I could do this differently?

running OS on bochs returned error

I'm working on an OS programming project called pintos. It is run on bochs following the command pintos run nameOfProcess
And here's the error message I get
Writing command line to /tmp/eKW3NMXoGT.dsk...
squish-pty bochs -q
========================================================================
Bochs x86 Emulator 2.5.1.svn
Built from SVN snapshot, after release 2.5.1
Compiled on Apr 6 2012 at 19:37:19
========================================================================
00000000000i[ ] reading configuration from bochsrc.txt
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
Next at t=0
Writing command line to /tmp/eKW3NMXoGT.dsk...
squish-pty bochs -q
========================================================================
Bochs x86 Emulator 2.5.1.svn
Built from SVN snapshot, after release 2.5.1
Compiled on Apr 6 2012 at 19:37:19
========================================================================
00000000000i[ ] reading configuration from bochsrc.txt
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): (invalid) ; ffff
<bochs:1> fgets() returned ERROR.
debugger interrupt request was 0
(0).[0] [0x00000000fffffff0] f000:fff0 (unk. ctxt): (invalid) ; ffff
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): (invalid) ; ffff
<bochs:1> fgets() returned ERROR.
debugger interrupt request was 0
(0).[0] [0x00000000fffffff0] f000:fff0 (unk. ctxt): (invalid) ; ffff
Also my bochsrc.txt
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xe0000
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
boot: disk
cpu: ips=1000000
megs: 4
log: bochsout.txt
panic: action=fatal
clock: sync=none, time0=0
ata0-master: type=disk, path=/tmp/eKW3NMXoGT.dsk, mode=flat, cylinders=1, heads=16, spt=63, translation=none
com1: enabled=1, mode=term, dev=/dev/stdout
Bochs was built from source with extra configurations on my Ubuntu 11.04
I had the same problem and I asked a question on OSDev forum.
I used file=$BXSHARE/BIOS-bochs-legacy because I needed 64K BIOS. It didn't work with:
romimage: file=$BXSHARE/BIOS-bochs-legacy, address=0xf0000
in .bochsrc file. And it works without "address=0xf0000" part.
Try to delete the start address of BIOS here:
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xe0000
Just leave:
romimage: file=$BXSHARE/BIOS-bochs-latest
in your bochsrc.txt
Install qemu instead of bosch:
sudo apt-get install qemu
If the version of qemu is recent then you need create a simbolyc link from "qemu-system-i386" to "qemu"
sudo ln -s /usr/bin/qemu-system-i386 /usr/bin/qemu
If the version of qemu is minor to 1.0 you don't need to do that. Now you can run Pintos using qemu, for example:
pintos --qemu -- run alarm-multiple

Resources