Skip to content

Commit

Permalink
bump to new buildroot and opencv 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jevois committed Jun 10, 2019
1 parent 1f9fd8d commit b97a838
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 7 deletions.
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ include_directories("include")
include_directories("..")

# Setup our library using the source files in src/Components and call it jevoisbase with the current version number:
jevois_setup_library(src/Components jevoisbase 1.12.0)
jevois_setup_library(src/Components jevoisbase 1.13.0)

# Setup our modules that are in src/Modules, make them depend on jevoisbase:
jevois_setup_modules(src/Modules jevoisbase)
Expand Down Expand Up @@ -233,7 +233,8 @@ add_definitions(-Wparentheses -w)
# ${JVB}/Contrib/cvEyeTracker-1.2.5/remove_corneal_reflection.cpp ${JVB}/Contrib/cvEyeTracker-1.2.5/svd.c)

########################################################################################################################
# Neon-accelerated NE10 support:
# Neon-accelerated Ne10 support. NOTE: as of JeVois 1.13.0, Ne10 is also installed on platform by default as a library,
# may want to use that in new code:
include_directories(Contrib/Ne10/inc)

target_sources(jevoisbase PRIVATE ${JVB}/Contrib/Ne10/modules/imgproc/NE10_boxfilter.c)
Expand Down Expand Up @@ -407,13 +408,14 @@ ${TFS}/allocation.cc ${TFS}/arena_planner.cc ${TFS}/context.c)

target_link_libraries(jevoisbase ${JEVOIS_OPENCV_LIBS} opencv_aruco opencv_bgsegm opencv_bioinspired opencv_calib3d
opencv_ccalib opencv_core opencv_datasets opencv_dnn_objdetect opencv_dnn opencv_dpm opencv_face opencv_features2d
opencv_flann opencv_fuzzy opencv_hfs opencv_imgcodecs opencv_img_hash opencv_imgproc
opencv_flann opencv_fuzzy opencv_gapi opencv_hfs opencv_imgcodecs opencv_img_hash opencv_imgproc
opencv_line_descriptor opencv_ml opencv_objdetect opencv_optflow opencv_phase_unwrapping opencv_photo opencv_plot
opencv_reg opencv_saliency opencv_shape opencv_stereo opencv_stitching opencv_structured_light opencv_superres
opencv_surface_matching opencv_text opencv_tracking opencv_videoio opencv_video opencv_videostab opencv_xfeatures2d
opencv_ximgproc opencv_xobjdetect opencv_xphoto)
opencv_quality opencv_reg opencv_saliency opencv_shape opencv_stereo opencv_stitching opencv_structured_light
opencv_superres opencv_surface_matching opencv_text opencv_tracking opencv_videoio opencv_video opencv_videostab
opencv_xfeatures2d opencv_ximgproc opencv_xobjdetect opencv_xphoto)
# removed: opencv_freetype (not available on platform), opencv_highgui (not needed), opencv_rgbd (not needed)


########################################################################################################################
# Install shared resources (cascade classifiers, neural network weights, etc):

Expand Down Expand Up @@ -465,7 +467,7 @@ else (JEVOIS_PLATFORM)
set(JEVOIS_DEPEND "jevois-host (>=${JEVOIS_VERSION_MAJOR}.${JEVOIS_VERSION_MINOR}.${JEVOIS_VERSION_PATCH})")
endif (JEVOIS_PLATFORM)

set(CPACK_DEBIAN_PACKAGE_DEPENDS "${JEVOIS_DEPEND}, libgles2-mesa, libgles2-mesa-dev, curl")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${JEVOIS_DEPEND}, libgles2-mesa, libgles2-mesa-dev, curl, libdmtx-dev, python3-scipy")

# Use helper from JeVois.cmake for all other settings:
jevois_setup_cpack("jevoisbase")
Expand Down
68 changes: 68 additions & 0 deletions src/Modules/PyDMTX/PyDMTX.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import libjevois as jevois
import cv2
import numpy as np
from pylibdmtx.pylibdmtx import decode

## Decoding of DataMatrix (DMTX) 2D barcodes
#
# This module finds and decodes DataMatrix 2D barcodes.
#
# It uses libdmtx as a backend, and the pylibdmtx python wrapper.
#
# On host, you will need: sudo apt install libdmtx-dev; pip install pylibdmtx
#
# @author Laurent Itti
#
# @videomapping YUYV 320 280 30.0 YUYV 320 240 30.0 JeVois PyDMTX
# @email itti\@usc.edu
# @address University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA
# @copyright Copyright (C) 2017 by Laurent Itti, iLab and the University of Southern California
# @mainurl http://jevois.org
# @supporturl http://jevois.org/doc
# @otherurl http://iLab.usc.edu
# @license GPL v3
# @distribution Unrestricted
# @restrictions None
# @ingroup modules
class PyDMTX:
# ###################################################################################################
## Constructor
def __init__(self):
# Instantiate a JeVois Timer to measure our processing framerate:
self.timer = jevois.Timer("dmtx", 100, jevois.LOG_INFO)

# ###################################################################################################
## Process function with USB output
def process(self, inframe, outframe):
# Get the next camera image (may block until it is captured) as OpenCV BGR:
inimg = inframe.getCvBGR()

# Start measuring image processing time (NOTE: does not account for input conversion time):
self.timer.start()

# Create dark-gray (value 80) image for the bottom panel, 40 pixels tall:
msgbox = np.zeros((40, inimg.shape[1], 3), dtype = np.uint8) + 80

# Find and decode any DataMatrix symbols:
dec = decode(inimg)

# Draw the results in the input image (which we will copy to output):
y = 13
for d in dec:
cv2.rectangle(inimg, (d.rect.left, d.rect.top), (d.rect.left+d.rect.width-1, d.rect.top+d.rect.height-1),
(255,0,0), 2)
cv2.putText(msgbox, d.data.decode("utf-8"), (3, y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255))
y = y + 12

# Create our output image as a copy of the input plus our message box:
outimg = np.vstack((inimg, msgbox))

# Write a title:
cv2.putText(outimg, "JeVois Python DataMatrix", (3, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255))

# Write frames/s info from our timer into the edge map (NOTE: does not account for output conversion time):
fps = self.timer.stop()
cv2.putText(outimg, fps, (3, inimg.shape[0] - 6), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255))

# Convert our OpenCv output image to video output format and send to host over USB:
outframe.sendCv(outimg)
Binary file added src/Modules/PyDMTX/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b97a838

Please sign in to comment.