Git Product home page Git Product logo

lycon's People

Contributors

aleozlx avatar ethereon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lycon's Issues

Cannot install for python3 on Ubuntu 16.04 (error with `PYTHON_LIB_PATH`)

Hi,

On an up to date 16.04 system, I get

$ sudo -H pip3 install lycon
Collecting lycon
  Using cached lycon-0.1.9.tar.gz
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from lycon)
Building wheels for collected packages: lycon
  Running setup.py bdist_wheel for lycon ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ir_6h7y2/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpr8js3gg7pip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/lycon
  copying lycon/__init__.py -> build/lib.linux-x86_64-3.5/lycon
  copying lycon/enum.py -> build/lib.linux-x86_64-3.5/lycon
  copying lycon/core.py -> build/lib.linux-x86_64-3.5/lycon
  running egg_info
  writing lycon.egg-info/PKG-INFO
  writing requirements to lycon.egg-info/requires.txt
  writing dependency_links to lycon.egg-info/dependency_links.txt
  writing top-level names to lycon.egg-info/top_level.txt
  warning: manifest_maker: standard file '-c' not found
  
  reading manifest file 'lycon.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'lycon.egg-info/SOURCES.txt'
  running build_ext
  Source path is /tmp/pip-build-ir_6h7y2/lycon
  -- The C compiler identification is GNU 5.4.0
  -- The CXX compiler identification is GNU 5.4.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
  -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54")
  -- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so
  -- Python binary: /usr/bin/python3
  -- Python include path: /usr/include/python3.5m
  -- Python library path: /usr/lib
  -- Python version: 3.5
  -- Expanding search for libpython
  -- Python library path: PYTHON_LIB_PATH-NOTFOUND
  -- NumPy include path: /usr/local/lib/python3.5/dist-packages/numpy/core/include
  CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  Please set them or make sure they are set and tested correctly in the CMake files:
  PYTHON_LIB_PATH
      linked by target "pycon" in directory /tmp/pip-build-ir_6h7y2/lycon
  
  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-build-ir_6h7y2/lycon/build/temp.linux-x86_64-3.5/CMakeFiles/CMakeOutput.log".
  	* Failed to build the Lycon native extension.
  	* [Error] Failed to exceute: /usr/bin/cmake /tmp/pip-build-ir_6h7y2/lycon -DPYTHON_BIN=/usr/bin/python3
  
  ----------------------------------------
  Failed building wheel for lycon
  Running setup.py clean for lycon
Failed to build lycon
Installing collected packages: lycon
  Running setup.py install for lycon ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ir_6h7y2/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-g6h2go1a-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/lycon
    copying lycon/__init__.py -> build/lib.linux-x86_64-3.5/lycon
    copying lycon/enum.py -> build/lib.linux-x86_64-3.5/lycon
    copying lycon/core.py -> build/lib.linux-x86_64-3.5/lycon
    running egg_info
    writing top-level names to lycon.egg-info/top_level.txt
    writing dependency_links to lycon.egg-info/dependency_links.txt
    writing lycon.egg-info/PKG-INFO
    writing requirements to lycon.egg-info/requires.txt
    warning: manifest_maker: standard file '-c' not found
    
    reading manifest file 'lycon.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'lycon.egg-info/SOURCES.txt'
    running build_ext
    Source path is /tmp/pip-build-ir_6h7y2/lycon
    -- The C compiler identification is GNU 5.4.0
    -- The CXX compiler identification is GNU 5.4.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
    -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54")
    -- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so
    -- Python binary: /usr/bin/python3
    -- Python include path: /usr/include/python3.5m
    -- Python library path: /usr/lib
    -- Python version: 3.5
    -- Expanding search for libpython
    -- Python library path: PYTHON_LIB_PATH-NOTFOUND
    -- NumPy include path: /usr/local/lib/python3.5/dist-packages/numpy/core/include
    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    PYTHON_LIB_PATH
        linked by target "pycon" in directory /tmp/pip-build-ir_6h7y2/lycon
    
    -- Configuring incomplete, errors occurred!
    See also "/tmp/pip-build-ir_6h7y2/lycon/build/temp.linux-x86_64-3.5/CMakeFiles/CMakeOutput.log".
    	* Failed to build the Lycon native extension.
    	* [Error] Failed to exceute: /usr/bin/cmake /tmp/pip-build-ir_6h7y2/lycon -DPYTHON_BIN=/usr/bin/python3
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ir_6h7y2/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-g6h2go1a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 255 in /tmp/pip-build-ir_6h7y2/lycon/

Even tough I tried exporting PYTHON_LIB_PATH to something meaningful

$ echo $PYTHON_LIB_PATH
/usr/lib/python3/dist-packages/

Options in save function

I tried to change jpeg quality on saving:

lycon.save(dest_image, resized, options={lycon.Encode.JPEG_QUALITY: 80})

and I got this error:

  File "/usr/local/var/pyenv/versions/3.5.3/envs/sa/lib/python3.5/site-packages/lycon/core.py", line 24, in save
    _lycon.save(path, image, options)
_lycon.PyconError: Assertion Failure: `output_vec.size() == num_elems` evaluated to false in `vector_from_pyobject` (/private/var/folders/jy/wf09twtn07zfx65xm7ycd3x80000gp/T/pip-build-u9q840_5/lycon/src/lycon/python/interop.h:86)

macos 10.12.4

When lycon.save 10000+ times, it occurs Fatal Python error: deallocating None

As title states

`
import lycon
from tqdm import tqdm
image_full_path = "00010640.jpg" # any image

for i in tqdm(range(20000)):
image = lycon.load(image_full_path)
image = lycon.resize(image, width=512, height=512, interpolation=lycon.Interpolation.LINEAR)
lycon.save("test.jpg", image)
`
It happens at about the 10344th iteration:

` 52%|██████████████████████████████████████████████████████████████████████████████████████▎ | 10344/20000 [01:06<00:56, 171.48it/s]Fatal Python error: deallocating None

Thread 0x00007f46eb57e700 (most recent call first):
File "/root/anaconda3/envs/xxx/lib/python3.7/threading.py", line 300 in wait
File "/root/anaconda3/envs/xxx/lib/python3.7/threading.py", line 552 in wait
File "/root/anaconda3/envs/xxx/lib/python3.7/site-packages/tqdm/_monitor.py", line 60 in run
File "/root/anaconda3/envs/xxx/lib/python3.7/threading.py", line 926 in _bootstrap_inner
File "/root/anaconda3/envs/xxx/lib/python3.7/threading.py", line 890 in _bootstrap
`

But if I use cv2.imwrite instead of lycon.save, no such fatal error happened
@ethereon @aleozlx

ModuleNotFoundError: No module named '_lycon'

Hello, I used the source code to install in my Anaconda environment but found the error:

import lycon
Traceback (most recent call last):
File "", line 1, in
File "/home/l00471854/anaconda3/envs/py36/lib/python3.6/site-packages/lycon-0.2.0-py3.6-linux-x86_64.egg/lycon/init.py", line 1, in
File "/home/l00471854/anaconda3/envs/py36/lib/python3.6/site-packages/lycon-0.2.0-py3.6-linux-x86_64.egg/lycon/core.py", line 1, in
ModuleNotFoundError: No module named '_lycon'

Could you please tell me how to solve it?
Thanks a lot!

Test things using CI

Along with #9 #8, you can do these things to make this library robust!
I'll try to do these if I get time and raise PRs.

Error installing on python 3.8.2, Ubuntu 18.04

I have the following error when installing lycon on python 3.8.2 on Ubuntu 18.04. However, I was used to install and use lycon through pip install on my Mac.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

python -V
Python 3.8.2

Virtualenvwrapper is used.
../.virtualenvs/xxx/bin/python

pip install lycon

Error:
Collecting lycon
Using cached lycon-0.2.0.tar.gz (129 kB)
Requirement already satisfied: numpy in ./.virtualenvs/classifiers/lib/python3.8/site-packages (from lycon) (1.19.0)
Building wheels for collected packages: lycon
Building wheel for lycon (setup.py) ... error
ERROR: Command errored out with exit status 255:
command: /home/xxx/.virtualenvs/xxx/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"'; file='"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-023xrg5h
cwd: /tmp/pip-install-h_mcqqq5/lycon/
Complete output (148 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/lycon
copying lycon/enum.py -> build/lib.linux-x86_64-3.8/lycon
copying lycon/core.py -> build/lib.linux-x86_64-3.8/lycon
copying lycon/init.py -> build/lib.linux-x86_64-3.8/lycon
running egg_info
writing lycon.egg-info/PKG-INFO
writing dependency_links to lycon.egg-info/dependency_links.txt
writing requirements to lycon.egg-info/requires.txt
writing top-level names to lycon.egg-info/top_level.txt
reading manifest file 'lycon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lycon.egg-info/SOURCES.txt'
running build_ext
Source path is /tmp/pip-install-h_mcqqq5/lycon
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Python binary: /home/xxx/.virtualenvs/xxx/bin/python3.8
-- Python include path: /usr/local/include/python3.8
-- Python library path: /usr/local/lib
-- Python version: 3.8
-- Python library path: /usr/local/lib/libpython3.8.a
-- NumPy include path: /home/xxx/.virtualenvs/xxx/lib/python3.8/site-packages/numpy/core/include
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-h_mcqqq5/lycon/build/temp.linux-x86_64-3.8
Starting build with 1 jobs
Scanning dependencies of target lycon
[ 3%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/base.cc.o
[ 7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/bitstream.cc.o
[ 10%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/exif.cc.o
[ 14%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/io.cc.o
[ 17%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/jpeg.cc.o
[ 21%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/png.cc.o
[ 25%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/allocator.cc.o
[ 28%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o
[ 32%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/copy.cc.o
[ 35%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/io_array.cc.o
[ 39%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/iterator.cc.o
[ 42%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/mat.cc.o
[ 46%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/umat_data.cc.o
In file included from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.h:4:0,
from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:1:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc: In destructor ‘lycon::UMatData::~UMatData()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:33:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(mapcount == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:33:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(mapcount == 0);
^~~~~~~~~~~~
[ 50%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/resize.cc.o
[ 53%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/rotate.cc.o
[ 57%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/alloc.cc.o
[ 60%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/color.cc.o
[ 64%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/file.cc.o
[ 67%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/hardware.cc.o
[ 71%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel_pthreads.cc.o
[ 75%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel.cc.o
[ 78%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/singleton.cc.o
[ 82%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/string.cc.o
[ 85%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/tls.cc.o
In file included from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:5:0:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc: In destructor ‘lycon::TlsAbstraction::~TlsAbstraction()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:81:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(pthread_key_delete(tlsKey) == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:81:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(pthread_key_delete(tlsKey) == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc: In destructor ‘virtual lycon::TLSDataContainer::~TLSDataContainer()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:275:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(key_ == -1); // Key must be released in child object
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:275:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(key_ == -1); // Key must be released in child object
^~~~~~~~~~~~
[ 89%] Linking CXX static library liblycon.a
[ 89%] Built target lycon
Scanning dependencies of target pycon
[ 92%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o
[ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/module.cc.o
[100%] Linking CXX shared library _lycon.so
/usr/bin/ld: /usr/local/lib/libpython3.8.a(abstract.o): relocation R_X86_64_PC32 against symbol `PyObject_SetItem' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/pycon.dir/build.make:102: recipe for target '_lycon.so' failed
make[2]: *** [_lycon.so] Error 1
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/pycon.dir/all' failed
make[1]: *** [CMakeFiles/pycon.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
* Failed to build the Lycon native extension.
* [Error] Failed to exceute: /usr/bin/make -j 1

ERROR: Failed building wheel for lycon
Running setup.py clean for lycon
Failed to build lycon
Installing collected packages: lycon
Running setup.py install for lycon ... error
ERROR: Command errored out with exit status 255:
command: /home/xxx/.virtualenvs/xxx/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"'; file='"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-07a1dhne/install-record.txt --single-version-externally-managed --compile --install-headers /home/xxx/.virtualenvs/classifiers/include/site/python3.8/lycon
cwd: /tmp/pip-install-h_mcqqq5/lycon/
Complete output (148 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/lycon
copying lycon/enum.py -> build/lib.linux-x86_64-3.8/lycon
copying lycon/core.py -> build/lib.linux-x86_64-3.8/lycon
copying lycon/init.py -> build/lib.linux-x86_64-3.8/lycon
running egg_info
writing lycon.egg-info/PKG-INFO
writing dependency_links to lycon.egg-info/dependency_links.txt
writing requirements to lycon.egg-info/requires.txt
writing top-level names to lycon.egg-info/top_level.txt
reading manifest file 'lycon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lycon.egg-info/SOURCES.txt'
running build_ext
Source path is /tmp/pip-install-h_mcqqq5/lycon
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Python binary: /home/xxx/.virtualenvs/xxx/bin/python3.8
-- Python include path: /usr/local/include/python3.8
-- Python library path: /usr/local/lib
-- Python version: 3.8
-- Python library path: /usr/local/lib/libpython3.8.a
-- NumPy include path: /home/xxx/.virtualenvs/xxx/lib/python3.8/site-packages/numpy/core/include
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-h_mcqqq5/lycon/build/temp.linux-x86_64-3.8
Starting build with 1 jobs
Scanning dependencies of target lycon
[ 3%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/base.cc.o
[ 7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/bitstream.cc.o
[ 10%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/exif.cc.o
[ 14%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/io.cc.o
[ 17%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/jpeg.cc.o
[ 21%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/png.cc.o
[ 25%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/allocator.cc.o
[ 28%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o
[ 32%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/copy.cc.o
[ 35%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/io_array.cc.o
[ 39%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/iterator.cc.o
[ 42%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/mat.cc.o
[ 46%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/umat_data.cc.o
In file included from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.h:4:0,
from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:1:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc: In destructor ‘lycon::UMatData::~UMatData()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:33:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(mapcount == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/mat/umat_data.cc:33:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(mapcount == 0);
^~~~~~~~~~~~
[ 50%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/resize.cc.o
[ 53%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/rotate.cc.o
[ 57%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/alloc.cc.o
[ 60%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/color.cc.o
[ 64%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/file.cc.o
[ 67%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/hardware.cc.o
[ 71%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel_pthreads.cc.o
[ 75%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel.cc.o
[ 78%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/singleton.cc.o
[ 82%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/string.cc.o
[ 85%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/tls.cc.o
In file included from /tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:5:0:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc: In destructor ‘lycon::TlsAbstraction::~TlsAbstraction()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:81:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(pthread_key_delete(tlsKey) == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:81:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(pthread_key_delete(tlsKey) == 0);
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc: In destructor ‘virtual lycon::TLSDataContainer::~TLSDataContainer()’:
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: warning: throw will always call terminate() [-Wterminate]
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:275:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(key_ == -1); // Key must be released in child object
^~~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:31:35: note: in C++11 destructors default to noexcept
throw RuntimeError(err_msg);
^
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/error.h:40:9: note: in expansion of macro ‘LYCON_ERROR’
LYCON_ERROR("Assertion Failure: %s evaluated to false in %s (%s:%d)", #expr, LYCON_Func, FILE, LINE)
^~~~~~~~~~~
/tmp/pip-install-h_mcqqq5/lycon/src/lycon/util/tls.cc:275:5: note: in expansion of macro ‘LYCON_ASSERT’
LYCON_ASSERT(key_ == -1); // Key must be released in child object
^~~~~~~~~~~~
[ 89%] Linking CXX static library liblycon.a
[ 89%] Built target lycon
Scanning dependencies of target pycon
[ 92%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o
[ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/module.cc.o
[100%] Linking CXX shared library _lycon.so
/usr/bin/ld: /usr/local/lib/libpython3.8.a(abstract.o): relocation R_X86_64_PC32 against symbol `PyObject_SetItem' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/pycon.dir/build.make:102: recipe for target '_lycon.so' failed
make[2]: *** [_lycon.so] Error 1
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/pycon.dir/all' failed
make[1]: *** [CMakeFiles/pycon.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
* Failed to build the Lycon native extension.
* [Error] Failed to exceute: /usr/bin/make -j 1

ERROR: Command errored out with exit status 255: /home/xxx/.virtualenvs/xxx/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"'; file='"'"'/tmp/pip-install-h_mcqqq5/lycon/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-07a1dhne/install-record.txt --single-version-externally-managed --compile --install-headers /home/xxx/.virtualenvs/xxx/include/site/python3.8/lycon Check the logs for full command output.

Affine Transformations

It would be great if lycon included affine transformations.

I use Lycon for loading of images for CNN training. Affine transformations are a common technique for augmentation. OpenCV is hard to install (the version installable with conda doesn't play nice with pytorch).

Problem installing pre-built wheel on AMD CPU

When installing lycon through pip using a pre-built wheel build on an AMD EPYC 7282 the installation fails to load with illegal instruction.

The solution to get around this was to install through pip with the following command:

pip install --no-binary=lycon lycon

This might hint at a problem with the pre-built binaries being optimized to specific to the build farm CPUs?

Alpha Channel

Reading in an RGBA png seems to ignore the alpha channel despite the Decode.UNCHANGED setting.

install error

Following the install instructions,
(1)my first step : checking all the dependency ,
sudo apt-get install cmake build-essential libjpeg-dev libpng-dev
below is the result:

nvidia@tegra-ubuntu:~$ sudo apt-get install cmake build-essential libjpeg-dev libpng-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libpng12-dev' instead of 'libpng-dev'
build-essential is already the newest version (12.1ubuntu2).
libjpeg-dev is already the newest version (8c-2ubuntu8).
libpng12-dev is already the newest version (1.2.54-1ubuntu1).
cmake is already the newest version (3.5.1-1ubuntu3).
The following packages were automatically installed and are no longer required:
bind9-host geoip-database libavahi-core7 libbind9-140 libdns162 libgeoip1 libisc160 libisccc140 libisccfg140 liblwres141
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.

(2)my second step : install lycon,
sudo pip install lycon
below is the result:

nvidia@tegra-ubuntu:~$ sudo pip install lycon
The directory '/home/nvidia/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/nvidia/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting lycon
Downloading lycon-0.1.9.tar.gz (129kB)
100% |████████████████████████████████| 133kB 1.2MB/s
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from lycon)
Installing collected packages: lycon
Running setup.py install for lycon ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-nYL9iq/lycon/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-x2BoCo-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-2.7
creating build/lib.linux-aarch64-2.7/lycon
copying lycon/enum.py -> build/lib.linux-aarch64-2.7/lycon
copying lycon/init.py -> build/lib.linux-aarch64-2.7/lycon
copying lycon/core.py -> build/lib.linux-aarch64-2.7/lycon
running egg_info
writing requirements to lycon.egg-info/requires.txt
writing lycon.egg-info/PKG-INFO
writing top-level names to lycon.egg-info/top_level.txt
writing dependency_links to lycon.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'lycon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lycon.egg-info/SOURCES.txt'
running build_ext
Source path is /tmp/pip-build-nYL9iq/lycon
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version "1.2.8")
-- Found PNG: /usr/lib/aarch64-linux-gnu/libpng.so (found version "1.2.54")
-- Found JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so
-- Python binary: /usr/bin/python
-- Python include path: /usr/include/python2.7
-- Python library path: /usr/lib
-- Python version: 2.7
-- Expanding search for libpython
-- Python library path: /usr/lib/aarch64-linux-gnu/libpython2.7.so
-- NumPy include path: /usr/local/lib/python2.7/dist-packages/numpy/core/include
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-build-nYL9iq/lycon/build/temp.linux-aarch64-2.7
Starting build with 4 jobs
Scanning dependencies of target lycon
[  7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/base.cc.o
[  7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/exif.cc.o
[ 10%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/io.cc.o
[ 14%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/bitstream.cc.o
[ 17%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/jpeg.cc.o
[ 21%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/png.cc.o
[ 25%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/allocator.cc.o
[ 28%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o
[ 32%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/copy.cc.o
[ 35%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/io_array.cc.o
[ 39%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/iterator.cc.o
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<unsigned char, unsigned char, float>::operator()(const uchar*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:289:65: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
                 vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst_0)), vqmovn_u32(cv_vrndq_u32_f32(v_dst_1)));
                                                                 ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<signed char, unsigned char, float>::operator()(const schar*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:331:65: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
                 vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst_0)), vqmovn_u32(cv_vrndq_u32_f32(v_dst_1)));
                                                                 ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<short unsigned int, unsigned char, float>::operator()(const ushort*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:362:65: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
                 vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst_0)), vqmovn_u32(cv_vrndq_u32_f32(v_dst_1)));
                                                                 ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<short int, unsigned char, float>::operator()(const short int*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:391:65: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
                 vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst_0)), vqmovn_u32(cv_vrndq_u32_f32(v_dst_1)));
                                                                 ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<int, unsigned char, float>::operator()(const int*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:411:70: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x4_t v_dsti_0 = vqmovn_u32(cv_vrndq_u32_f32(v_dst_0));
                                                                      ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScaleAbs_SIMD<float, unsigned char, float>::operator()(const float*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:436:70: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x4_t v_dsti_0 = vqmovn_u32(cv_vrndq_u32_f32(v_dst_0));
                                                                      ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<unsigned char, unsigned char, float>::operator()(const uchar*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:1981:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<unsigned char, signed char, float>::operator()(const uchar*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2002:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<unsigned char, short unsigned int, float>::operator()(const uchar*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2023:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<unsigned char, short int, float>::operator()(const uchar*, short int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2044:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<unsigned char, int, float>::operator()(const uchar*, int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2065:55: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(v_dst1));
                                                       ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<signed char, unsigned char, float>::operator()(const schar*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2107:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<signed char, signed char, float>::operator()(const schar*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2128:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<signed char, short unsigned int, float>::operator()(const schar*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2149:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<signed char, short int, float>::operator()(const schar*, short int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2170:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<signed char, int, float>::operator()(const schar*, int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2191:55: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(v_dst1));
                                                       ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short unsigned int, unsigned char, float>::operator()(const ushort*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2233:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short unsigned int, signed char, float>::operator()(const ushort*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2254:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short unsigned int, short unsigned int, float>::operator()(const ushort*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2275:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short unsigned int, short int, float>::operator()(const ushort*, short int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2296:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short unsigned int, int, float>::operator()(const ushort*, int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2317:55: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(v_dst1));
                                                       ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short int, unsigned char, float>::operator()(const short int*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2359:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short int, signed char, float>::operator()(const short int*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2380:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<short int, short unsigned int, float>::operator()(const short int*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2401:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<int, unsigned char, float>::operator()(const int*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2442:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<int, signed char, float>::operator()(const int*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2462:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<int, short unsigned int, float>::operator()(const int*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2482:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<int, short int, float>::operator()(const int*, short int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2502:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<float, unsigned char, float>::operator()(const float*, lycon::uchar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2524:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<float, signed char, float>::operator()(const float*, lycon::schar*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2544:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<float, short unsigned int, float>::operator()(const float*, lycon::ushort*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2564:79: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint16x8_t v_dst = vcombine_u16(vqmovn_u32(cv_vrndq_u32_f32(v_dst1)), vqmovn_u32(cv_vrndq_u32_f32(v_dst2)));
                                                                               ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<float, short int, float>::operator()(const float*, short int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2584:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_dst1)), vqmovn_s32(cv_vrndq_s32_f32(v_dst2)));
                                                                              ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::cvtScale_SIMD<float, int, float>::operator()(const float*, int*, int, float, float) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2600:107: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(vaddq_f32(vmulq_f32(vld1q_f32(src + x), v_scale), v_shift)));
                                                                                                           ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In function ‘void lycon::cvtScale_(const T*, size_t, DT*, size_t, lycon::Size, WT, WT) [with T = short int; DT = short int; WT = float; size_t = long unsigned int; lycon::Size = lycon::Size_<int>]’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2696:70: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
                       vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_tmp1)), vqmovn_s32(cv_vrndq_s32_f32(v_tmp2))));
                                                                      ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In function ‘void lycon::cvtScale_(const T*, size_t, DT*, size_t, lycon::Size, WT, WT) [with T = short int; DT = int; WT = float; size_t = long unsigned int; lycon::Size = lycon::Size_<int>]’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:2765:55: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(v_tmp1));
                                                       ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::Cvt_SIMD<float, unsigned char>::operator()(const float*, lycon::uchar*, int) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:3378:68: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint32x4_t v_src1 = cv_vrndq_u32_f32(vld1q_f32(src + x));
                                                                    ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::Cvt_SIMD<float, signed char>::operator()(const float*, lycon::schar*, int) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:3399:67: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int32x4_t v_src1 = cv_vrndq_s32_f32(vld1q_f32(src + x));
                                                                   ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::Cvt_SIMD<float, short unsigned int>::operator()(const float*, lycon::ushort*, int) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:3420:68: error: ‘cv_vrndq_u32_f32’ was not declared in this scope
             uint32x4_t v_src1 = cv_vrndq_u32_f32(vld1q_f32(src + x));
                                                                    ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In member function ‘int lycon::Cvt_SIMD<float, int>::operator()(const float*, int*, int) const’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:3436:67: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             vst1q_s32(dst + x, cv_vrndq_s32_f32(vld1q_f32(src + x)));
                                                                   ^
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc: In function ‘void lycon::cvt_(const T*, size_t, DT*, size_t, lycon::Size) [with T = float; DT = short int; size_t = long unsigned int; lycon::Size = lycon::Size_<int>]’:
/tmp/pip-build-nYL9iq/lycon/src/lycon/mat/convert.cc:3739:78: error: ‘cv_vrndq_s32_f32’ was not declared in this scope
             int16x8_t v_dst = vcombine_s16(vqmovn_s32(cv_vrndq_s32_f32(v_src1)), vqmovn_s32(cv_vrndq_s32_f32(v_src2)));
                                                                              ^
CMakeFiles/lycon.dir/build.make:230: recipe for target 'CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o' failed
make[2]: *** [CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/lycon.dir/all' failed
make[1]: *** [CMakeFiles/lycon.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
    * Failed to build the Lycon native extension.
    * [Error] Failed to exceute: /usr/bin/make -j 4

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-nYL9iq/lycon/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-x2BoCo-record/install-record.txt --single-version-externally-managed --compile" failed with error code 255 in /tmp/pip-build-nYL9iq/lycon/
nvidia@tegra-ubuntu:~$

How to fix the errors?

Ignore orientation

Hi There,

Great library (very fast). I'd love to use it bit can't get the lycon.load() function to ignore the image orientation when loading. Any pointers?

Thanks!

are numpy headers being included in the Extensions?

I'm on a pretty clean Ubuntu environment and I installed the dependencies for the native extensions listed in the README. My pip install lycon command failed like this:

[... snip ...]
    [ 82%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/string.cc.o
    [ 85%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/tls.cc.o
    [ 89%] Linking CXX static library liblycon.a
    [ 89%] Built target lycon
    Scanning dependencies of target pycon
    [ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o
    [ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/module.cc.o
    In file included from /tmp/pip-build-vbh9Vg/lycon/src/lycon/python/interop.cc:5:0:
    /tmp/pip-build-vbh9Vg/lycon/src/lycon/python/numpy.h:9:33: fatal error: numpy/ndarrayobject.h: No such file or directory
    compilation terminated.
    In file included from /tmp/pip-build-vbh9Vg/lycon/src/lycon/python/module.cc:9:0:
    /tmp/pip-build-vbh9Vg/lycon/src/lycon/python/numpy.h:9:33: fatal error: numpy/ndarrayobject.h: No such file or directory
    compilation terminated.
    CMakeFiles/pycon.dir/build.make:62: recipe for target 'CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o' failed
    make[2]: *** [CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    CMakeFiles/pycon.dir/build.make:86: recipe for target 'CMakeFiles/pycon.dir/src/lycon/python/module.cc.o' failed
    make[2]: *** [CMakeFiles/pycon.dir/src/lycon/python/module.cc.o] Error 1
    CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pycon.dir/all' failed
    make[1]: *** [CMakeFiles/pycon.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
        * Failed to build the Lycon native extension.
        * [Error] Failed to exceute: /usr/bin/make -j 4

    ----------------------------------------
Command "/home/ubuntu/miniconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vbh9Vg/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-XFjuk5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 255 in /tmp/pip-build-vbh9Vg/lycon/

I think I fixed it by setting CPATH to the output of python -c "import numpy as np; print np.get_include()". Since I'm using the Anaconda python distribution, for me those are in /home/ubuntu/miniconda2/lib/python2.7/site-packages/numpy/core/include.

You might be able to fix this by calling np.get_include() somewhere in your setup.py and forwarding it to your build process, but I haven't looked in detail. I'm sure you have a better idea of how to fix it!

Cannot use lycon and TensorFlow in same project

Hello,

I'm trying to use lycon in a project to rescale images before feeding them into TensorFlow. However, when importing both lycon and TensorFlow in a python application, TensorFlow crashes.

import lycon
import tensorflow as tf

x = tf.placeholder(tf.float32)

Running this code results in the following error

2017-09-10 13:32:53.687783: F tensorflow/core/framework/op.cc:165] Non-OK-status: RegisterAlreadyLocked(deferred_[i]) status: Invalid argument: Could not parse default value '4000' from Attr("upper_frequency_limit: float = 4000") for Op Mfcc
Could not parse default value '20' from Attr("lower_frequency_limit: float = 20") for Op Mfcc

Note I'm not trying to say lycon is at fault here, it might very well be a bug in TensorFlow, but I really don't know where to start. I'm using python 3.5 and the latest version of TensorFlow (1.3.0) and lycon, both installed through pip3. I was hoping you might have a clue what's going on here.

Thanks in advance

PowerPC: unrecognized command line option ‘-march=native’

Could not install from pip on PowerPC architecture. GCC output: c++: error: unrecognized command line option ‘-march=native’
I found another project where it caused problems: mfem/mfem#216

The solution is to clone this repository and edit CMakeLists.txt - just remove -march=native. Then execute pip install . from the repository directory.
The speed difference is real!

Make it possible to load image from a buffer

Right now it's only possible to load image from a file. I have a use case where I would like to load image from a buffer, specifically the the response contents returned by requests library, e.g.:

import lycon
import requests

response = requests.get("https://example.com/image.jpeg")
image = lycon.load(response.content)

how to install lycon without sudo permission

Hello, I want to install the lycon with pip install lycon, but it comes with the error:
image
My cmake version is 3.2 and I could not use the sudo command line in readme.md
Could you give me some suggestions?

Lycon image loading gives different pixel values than Pillow

When using lycon to load an image, the pixel values differ from loading from PIL and converting to NumPy

Reproduce:

import lycon
import numpy as np
from PIL import Image

path = "/path/to/image.jpg"

img1 = lycon.load(path).astype(np.float32)
img2 = np.asarray(Image.open(path)).astype(np.float32)

np.all(img1 == img2)

This will return False. In my testing the pixel values differ in ~11% of locations and differ by an average of 1.46

So in 11% of the image, if the PIL pixel value is 144, lycon is either around 145.5 or 142.5.

Cannot build on MacOS 10.14

Hello,

I'm having some trouble installing lycon.. It seems like the install process cannot run the make command without failing.

Here is the console output:

Installing collected packages: lycon
  Running setup.py install for lycon ... error
    Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-lx37z3k4/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_pdsb3fp/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-x86_64-3.7
    creating build/lib.macosx-10.14-x86_64-3.7/lycon
    copying lycon/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/lycon
    copying lycon/core.py -> build/lib.macosx-10.14-x86_64-3.7/lycon
    copying lycon/enum.py -> build/lib.macosx-10.14-x86_64-3.7/lycon
    running egg_info
    writing lycon.egg-info/PKG-INFO
    writing dependency_links to lycon.egg-info/dependency_links.txt
    writing requirements to lycon.egg-info/requires.txt
    writing top-level names to lycon.egg-info/top_level.txt
    reading manifest file 'lycon.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'lycon.egg-info/SOURCES.txt'
    running build_ext
    Source path is /private/tmp/pip-install-lx37z3k4/lycon
    -- The C compiler identification is AppleClang 10.0.0.10001038
    -- The CXX compiler identification is AppleClang 10.0.0.10001038
    -- Check for working C compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
    -- Check for working C compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
    -- Check for working CXX compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
    -- Found PNG: /usr/local/lib/libpng.dylib (found version "1.4.12")
    -- Found JPEG: /usr/local/lib/libjpeg.dylib (found version "80")
    -- Python binary: /usr/local/opt/python/bin/python3.7
    -- Python include path: /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m
    -- Python library path: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib
    -- Python version: 3.7
    -- Python library path: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib
    -- NumPy include path: /usr/local/lib/python3.7/site-packages/numpy/core/include
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /tmp/pip-install-lx37z3k4/lycon/build/temp.macosx-10.14-x86_64-3.7
    Starting build with 8 jobs
    Scanning dependencies of target lycon
    [  7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/base.cc.o
    [  7%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/io.cc.o
    [ 10%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/png.cc.o
    [ 17%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/jpeg.cc.o
    [ 17%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/bitstream.cc.o
    [ 21%] Building CXX object CMakeFiles/lycon.dir/src/lycon/io/exif.cc.o
    [ 25%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/convert.cc.o
    [ 28%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/allocator.cc.o
    [ 32%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/copy.cc.o
    [ 35%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/io_array.cc.o
    [ 39%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/iterator.cc.o
    [ 42%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/mat.cc.o
    [ 46%] Building CXX object CMakeFiles/lycon.dir/src/lycon/mat/umat_data.cc.o
    [ 50%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/resize.cc.o
    [ 53%] Building CXX object CMakeFiles/lycon.dir/src/lycon/transform/rotate.cc.o
    [ 57%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/alloc.cc.o
    [ 60%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/color.cc.o
    [ 64%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/file.cc.o
    [ 67%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/hardware.cc.o
    [ 71%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel_pthreads.cc.o
    [ 75%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/parallel.cc.o
    [ 78%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/singleton.cc.o
    [ 82%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/string.cc.o
    [ 85%] Building CXX object CMakeFiles/lycon.dir/src/lycon/util/tls.cc.o
    [ 89%] Linking CXX static library liblycon.a
    [ 89%] Built target lycon
    Scanning dependencies of target pycon
    [ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/module.cc.o
    [ 96%] Building CXX object CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o
    /tmp/pip-install-lx37z3k4/lycon/src/lycon/python/interop.cc:321:11: error: cannot initializea variable of type 'char *' with an rvalue of type 'const char *'
        char* str = PyString_AsString(object);
              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    make[2]: *** [CMakeFiles/pycon.dir/src/lycon/python/interop.cc.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [CMakeFiles/pycon.dir/all] Error 2
    make: *** [all] Error 2
        * Failed to build the Lycon native extension.
        * [Error] Failed to exceute: /usr/bin/make -j 8

    ----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-lx37z3k4/lycon/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-_pdsb3fp/install-record.txt --single-version-externally-managed --compile" failed with error code 255 in /private/tmp/pip-install-lx37z3k4/lycon/

Before I start messing around with that error I wanted to make sure there is nothing else I could do?

Segmentation fault python

I just installer the lib and I can't even import it without having a SEG fault .

➜  image-optimization python
Python 3.7.3 (default, Oct 23 2019, 01:52:42)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lycon
[1]    47011 segmentation fault  python

Python 3.7.3
pip 20.1.1
macOS 10.15.5 (Catalina)

Importing lycon causes Fatal Python Error

This problem started happening just yesterday. Prior, lycon imported and functioned with zero problems.

Runningimport lycon causes:
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

Python 2.7.15
macOS 10.13.6 (High Sierra)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.