Giter Site home page Giter Site logo

lowpoly's People

Contributors

darkforte avatar fredhuangbia avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

lowpoly's Issues

Setup guide for OSX 10.14

Hello!
First of all thank you so much for sharing!

I'd like to share my experience about running this project in my Macbook OSX 10.14. As JS developer it was a nice challenge to compile and run :D so i am here to share my experience. So hope of utility for others

Cuda Toolkit 8.0 (even if you don't own NVIDIA in your system)

Add CUDA PATH to your .bashrc or .zshrc

export PATH=/Developer/NVIDIA/CUDA-8.0/bin${PATH:+:${PATH}}
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-8.0/lib\
 ${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}

Downgrade OSX Command Line Tools

  • NVCC will not work with OSX Command Line tools > 8.3 because it has strict dependency on LibSystem of your current OS (not working with default OSX > 10.10 xcode >= 9.0)
otool -L /Developer/NVIDIA/CUDA-8.0/bin/nvcc 
/Developer/NVIDIA/CUDA-8.0/bin/nvcc:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)

Make sure you have xcode basics installed

xcode-select install

Download CMT Mount DMG, Install the PKG

Get CMT from apple old archives: Download CLT for XCode 8.2
Dec 2016

Activate it (downgrade)
 sudo xcode-select --switch /Library/Developer/CommandLineTools

Later you may want to revert this change, if you want/can/must restore back to defaults once you finish with this project sudo xcode-select --reset

Install Opencv@3

 brew install opencv@3

Add paths to your bash profile

export PKG_CONFIG_PATH=/usr/local/opt/opencv@3/lib/pkgconfig

Configure opencv3:

pkg-config --cflags --libs opencv

Clone repository and edit CMakeLists.txt

I removed -gencode arch=compute_61,code=sm_61 NVCC_FLAG and included opencv directory
cmake_minimum_required (VERSION 2.8)

set (OPENCV_PATH "/usr/local/opt/opencv@3")

project ("LowPoly")

FIND_PACKAGE(CUDA REQUIRED)

set(CUDA_SEPARABLE_COMPILATION ON)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11")
SET (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-O3;--std=c++11;")

message(${CUDA_NVCC_FLAGS})

include_directories(${OPENCV_PATH}/include)

# Include sub-projects.
add_subdirectory ("src")

Edit src/CMakeLists.txt

Find line with LINK_DIRECTORIES and change to follow

LINK_DIRECTORIES(/usr/local/opt/opencv@3/lib)

PATCH CUDA TOOLKIT LIBRARY

I had compilation errors at cuda library, you can fix and patch manually by your self:
Edit as sudo following file

/Developer/NVIDIA/CUDA-8.0/include/thrust/system/cuda/detail/cub/util_ptx.cuh

Change lines

  • (LN 573) return __all(cond); into return ::__all(cond);
  • (LN 599) return __any(cond); into return ::__any(cond);

Build with CLion

I found very useful IDE CLion for OSX, as JS dev it was easy to load CMakeLists.txt and rebuild.

Run

./cmake-build-debug/LowPoly -c -i test.jpg -t 30.0 -b 0.2 -e 10e-3 -n 10e-4

Questions:

@DarkForte @FredHuangBia can you give an example how to save Edge Detection and Selected vertices output as image?

Troubleshooting

This is how my env looks like

/Library/Developer/CommandLineTools/usr/bin/c++ --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
/usr/bin/make --version                                  
GNU Make 3.81
Copyright (C) 2006  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.

This program built for i386-apple-darwin11.3.0
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:46_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

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.