Error while saving in jpeg format with using of imwrite - octave

I'm using Octave 3.6.4 with image-2.0.0 package installed. So, I got imfilter and other functions from this package working very well.
But when I try to do something like this:
imwrite(zeros([5 5 3],'uint8'),'1.jpeg')
I got error as follows:
error: imwrite: jpeg: unsupported or invalid image format
I'm using Lubuntu(think this is last stable one)
How can this be with jpeg? Also, imwrite currently working only with bmp as target format.
I was not able to find something in the web.
Any ideas?
Thanks in advance.

As I mentioned on the comments to the question, that's a very weird error, most likely a problem with the GraphicsMagick library. The command gm -version will show a table with all the formats that it was built to support. Here's my output:
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG yes
JPEG-2000 yes
JPEG yes
Little CMS yes
Loadable Modules no
OpenMP yes (201107)
PNG yes
TIFF yes
TRIO no
UMEM no
WMF yes
X11 yes
XML yes
ZLIB yes
If you're building Octave and GraphicsMagick from source, I recommend you take a look at the instructions I wrote to build Octave and GraphicsMagick in Debian (and debian based distros).

Related

TensorFlow Bazel Configuration

We are using a GTX 1080
with Ubuntu 16.04,
we installed CUDA 7.5, cudnn v5.1
We used compute capabilities 6.1
The 16.04 installation of CUDA was
made using the 15.04 Ubuntu version
and some very minor changes suggested by
https://www.pugetsystems.com/labs/hpc/NVIDIA-CUDA-with-Ubuntu-16-04-beta-on-a-laptop-if-you-just-cannot-wait-775/
All this seems to have worked fine.
In trying to install tensorflow from sources, per Google's
instructions for anything other than the default configuration,
we have run into a problem.
We do not know if this is something wrong on your end or Google's.
If you cannot help us, can you refer us to someone who can?
Thank you.
Below is the relevant run from a script file, with embedded special characters edited out.
laefsky#main:~/anaconda2/envs/tensorflow/tensorflow file://main/home/laefsky/anaconda2/envs/tensorflow/tensorflow(tensorflow) laefsky#main: ~/anaconda2/envs/tensorflow/tensorflow laefsky#main ~/anaconda2/envs/tensorflow/tensorflow$ ./configure
~/anaconda2/envs/tensorflow/tensorflow ~/anaconda2/envs/tensorflow/tensorflow
Please specify the location of python. [Default is /home/laefsky/anaconda2/envs/tensorflow/bin/python]:
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
No Google Cloud Platform support will be enabled for TensorFlow
Found possible Python library paths:
/home/laefsky/anaconda2/envs/tensorflow/lib/python2.7/site-packages
Please input the desired Python library path to use. Default is [/home/laefsky/anaconda2/envs/tensorflow/lib/python2.7/site-packages]
/home/laefsky/anaconda2/envs/tensorflow/lib/python2.7/site-packages
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]:
Please specify the location where CUDA toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify the Cudnn version you want to use. [Leave empty to use system default]:
Please specify the location where cuDNN library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]: "6.1"
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
......
ERROR: /home/laefsky/anaconda2/envs/tensorflow/tensorflow/third_party/gpus/cuda_configure.bzl:442:18: function 'repository_rule' does not exist.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package 'external': Extension file '#local_config_cuda//cuda:build_defs.bzl' may not be loaded from a WORKSPACE file since the extension file is located in an external repository.
Configuration finished
laefsky#main:~/anaconda2/envs/tensorflow/tensorflow[]7;file://main/home/laefsky/anaconda2/envs/tensorflow/tensorflow(tensorflow) []0;laefsky#main: ~/anaconda2/envs/tensorflow/tensorflow[[01;32mlaefsky#main[[00m:[[01;34m~/anaconda2/envs/tensorflow/tensorflow$ logout

How to read gvfs file by TStream

Linux feature is gvfs. I see TFileStream don't support gvfs files. So I need some other TStream object to read gvfs files. Do such streams exist?
Lazarus 1.7, fpc 3.0
gvfs exposed to system as files:
/run/user/1000/gvfs/ftp:host=ftp.scene.org/ls-lR
If these are proper files to the Linux kernel, I don't see why Lazarus would fail.
To check what is exactly happening you might want to use strace on a simplest as possible program.
The call that fails could give you a clue what is happening. (like e.g. permissions)

configure: WARNING: FFTW3F library not found. The slower FFTPACK library will be used instead

I'm compiling octave on my LFS - Linux from scratch - system.
While configuring octave, I receive a warning:
configure: WARNING: FFTW3F library not found. The slower FFTPACK library will be used instead.
I compiled and installed FFTW 3.3.4, and then reconfigured octave, however I still receive the following messages:
checking fftw3.h usability... yes
checking fftw3.h presence... yes
checking for fftw3.h... yes
checking for fftw_plan_dft_1d in -lfftw3... yes
checking for fftw3.h... (cached) yes
checking for fftwf_plan_dft_1d in -lfftw3f... no
configure: WARNING: FFTW3F library not found. The slower FFTPACK library will be used instead.
I notice that FFTW 3.3.4 installs libfftw3.so but NOT libfftw3f.so, that's why even after installing FFTW 3.3.4, octave cannot find FFTW3F library. Now, I wonder how I can install libfftw3f.so.
It looks like you have the double precision FFTW libraries (libfftw3) but not the single precision versions (libfftw3f). Build it again with:
./configure --enable-float --enable-sse && make install
(assuming we're talking x86 here).
This should then install the libfftw3f libraries next to the existing libfftw3 libs.

Where does Ruby's have_header method look for header files?

On a CentOS 5.7 box, I'm having trouble installing the newest version of the mysql2 gem; it's not finding errmsg.h:
/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... no
checking for mysql/mysql.h... yes
checking for errmsg.h... no
-----
errmsg.h is missing. please check your installation of mysql and try again.
-----
*** extconf.rb failed ***
The mysql header files exist at /usr/include/mysql. An older version of the gem exists on the server, so it must have been built successfully at one point.
Note that it fails on a check for mysql.h, but succeeds on mysql/mysql.h. However, it doesn't repeat this for errmsg.h. By this I'm guessing that it's not looking at /usr/include, but I'm not sure.
I've dug into the extconf.rb source code and discovered that it's using the have_header method to locate the header files. I debugged the execution to find out that it's looking for a relative path of "mysql/errmsg.h". But I haven't found any documentation that explains how it expands that into an absolute path.
Where & how does have_header locate its header files?
I believe I've found an answer.
It appears that have_header looks at the system include path. If the relevant environment variables are not set, the default include paths are /usr/local/include and /usr/include.
If you want to set them manually, you would do something like:
export C_INCLUDE_PATH=/usr/include/mysql/
That's true even if you're compiling a C++ program, if the header file is a C file. If, on the other hand, your header file is C++, not C, you would do:
export CPLUS_INCLUDE_PATH=/usr/include/mysql
Of course, you found the work-around, which is to include dir_config('mysql') in your extconf.rb. That enables you to use the --with-mysql-include option and supply the path manually.
Here's my source: http://www.network-theory.co.uk/docs/gccintro/gccintro_23.html
And here's a more general version of the same question (with answers): How to add a default include path for gcc in linux?

Macports compile of MySQL++ failing

Before running "sudo port install mysqlxx +universal", I installed the universal variant of mysql5.
...
checking whether -lm is needed to use C math functions... no
checking whether -lsocket is needed... no
checking whether -lnsl is needed... no
checking for MySQL library directory... /opt/local/lib/mysql5/mysql
checking for MySQL include directory... /opt/local/include/mysql5/mysql
checking if we can link to MySQL C API library directly... no
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzread in -lz... yes
checking whether adding -lz will let MySQL C API link succeed... no
configure: error: Unable to link to MySQL client library!
I suspect what's going on here is that you're running Snow Leopard. In previous versions of OS X, the default C++ compiler built 32-bit executables by default, but this changed to 64-bit in Snow Leopard. This can cause link problems with the MySQL C API library if it's not built as a Universal library supporting both 64- and 32-bit executables.
There are a bunch of ways around this problem, but most of the ones I know about either won't work with MacPorts or I don't know how to make them work. I've added a section on this to the MySQL++ README for Mac OS X, which you can read online, here.
Perhaps you can figure out how to adapt these solutions to the MacPorts build system. Something like this might work:
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 sudo port install mysqlxx +universal
That depends on those environment variables making it through the sudo and port barriers. You might have to get trickier. For instance:
sudo -s
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 port install mysqlxx +universal
As I commented above, it might be simplest to just build from the source tarball.