Skip to content

Instantly share code, notes, and snippets.

@ZhangMenghe
ZhangMenghe / conda_bug.md
Created February 5, 2019 18:53
[Environment][Conda]Import on Jupyter notebook failed where command prompt works

Usually that indicates that the notebook is running with a different Python or in a different environment from Python in the command prompt. Check sys.executable to see which Python it's running in, and sys.path to see where it's looking for imports.

Solution:

$ /Users/abc/anaconda/bin/python -m pip install ipykernel $ /Users/abc/anaconda/bin/python -m ipykernel install --user

@ZhangMenghe
ZhangMenghe / yuv2rgb.cpp
Created January 8, 2019 00:40
Convert Ndk image(AImage) to RGB image.
//Here shows the ordinary conversion and the method use OpenCV
static inline uint32_t YUV2RGB(int nY, int nU, int nV, uint8_t&r, uint8_t&g, uint8_t&b) {
nY -= 16;
nU -= 128;
nV -= 128;
if (nY < 0) nY = 0;
// This is the floating point equivalent. We do the conversion in integer
// because some Android devices do not have floating point in hardware.
// nR = (int)(1.164 * nY + 1.596 * nV);