Skip to content

Commit

Permalink
automatic camera sensor detection, add reset() to Parameter, more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jevois committed Sep 11, 2019
1 parent eb9e1ed commit 99e82a3
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set(JEVOIS_VENDOR "JeVois")
########################################################################################################################
# Project version:
set(JEVOIS_VERSION_MAJOR 1)
set(JEVOIS_VERSION_MINOR 13)
set(JEVOIS_VERSION_MINOR 14)
set(JEVOIS_VERSION_PATCH 0)
set(JEVOIS_SOVERSION "${JEVOIS_VERSION_MAJOR}.${JEVOIS_VERSION_MINOR}.${JEVOIS_VERSION_PATCH}" )

Expand Down Expand Up @@ -55,7 +55,7 @@ set(JEVOIS_PLATFORM_PYTHON_M "m")
# OpenCV version to use with JeVois:
set(JEVOIS_OPENCV_MAJOR 4)
set(JEVOIS_OPENCV_MINOR 1)
set(JEVOIS_OPENCV_PATCH 0)
set(JEVOIS_OPENCV_PATCH 1)
set(JEVOIS_OPENCV_VERSION "${JEVOIS_OPENCV_MAJOR}.${JEVOIS_OPENCV_MINOR}.${JEVOIS_OPENCV_PATCH}")

########################################################################################################################
Expand Down Expand Up @@ -155,7 +155,7 @@ set(JEVOIS_HOST_OPENCV_LIBS "-L${JEVOIS_HOST_OPENCV_PREFIX}/lib ${OPENCV_LIBS_FO
# Use TBB and kernel includes for platform from the buildroot installation. On the host, we may have local packages,
# eg, latest opencv compiled from source:
set(JEVOIS_KERNEL_INCLUDE "-I${JEVOIS_BUILDROOT_BASE}/build/linux-headers-3.4.113/usr/include")
set(JEVOIS_TBB_INCLUDE "-I${JEVOIS_BUILDROOT_BASE}/build/opencv3-${JEVOIS_OPENCV_VERSION}/buildroot-build/3rdparty/tbb/tbb-2018_U1/include")
set(JEVOIS_TBB_INCLUDE "-I${JEVOIS_BUILDROOT_BASE}/build/opencv3-${JEVOIS_OPENCV_VERSION}/buildroot-build/3rdparty/tbb/tbb-2019_U8/include")

# Find python 3.x on host and platform:
# NOTE: it is too early here to try to use standard find_package() of CMake. In any case, that will not find the
Expand Down
16 changes: 12 additions & 4 deletions bin/jevois.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
##############################################################################################################

CAMERA=ov9650
if [ -f /boot/sensor ]; then CAMERA=`tail -1 /boot/sensor`; fi
if [ -f /boot/sensor ]; then CAMERA=$(tail -1 /boot/sensor | tr -d '\r\n'); fi

use_usbserial=1 # Allow using a serial-over-USB to communicate with JeVois command-line interface
use_usbsd=1 # Allow exposing the JEVOIS partition of the microSD as a USB drive
Expand Down Expand Up @@ -37,10 +37,18 @@ elif [ -f /boot/usbserialtty ]; then use_usbserialtty=1; echo "Using tty on JeVo
cd /lib/modules/3.4.39

for m in videobuf-core videobuf-dma-contig videodev vfe_os vfe_subdev v4l2-common v4l2-int-device \
cci ${CAMERA} vfe_v4l2 ump disp mali ; do
cci vfe_v4l2 ump disp mali ; do
if [ $m = "vfe_v4l2" ]; then
echo "### insmod ${m}.ko sensor=${CAMERA} ###"
insmod ${m}.ko sensor="${CAMERA}"
# Try to detect the sensor. Start with the one that was selected, and, if that fails, try all others:
for s in ${CAMERA} ov7725 ov2640 ar0135 ov9650; do
echo "### insmod ${s}.ko ###"
insmod ${s}.ko
echo "### insmod ${m}.ko sensor=${s} ###"
insmod ${m}.ko sensor="${s}"
if [ $? -eq 0 ]; then CAMERA="${s}"; break; fi
echo "### rmmod ${s}.ko ###"
rmmod ${s}.ko
done
else
echo "### insmod ${m}.ko ###"
insmod ${m}.ko
Expand Down
39 changes: 39 additions & 0 deletions doc/Change114log.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*! \page Change114log Changes and new features in JeVois 1.14


JeVois 1.14 brings the following new features:

- Bumped to OpenCV 4.1.1 with all contrib modules including deep neural networks (DNN) and non-free.

- New automatic camera sensor detection. It is now optional to write a file \b BOOT:sensor with the name of the sensor
installed in your JeVois smart camera (ov9650, ov7725, ov2640, ar0135, etc). You will still speed-up your JeVois boot
time if you have the correct sensor in \b BOOT:sensor, but JeVois will now try all supported sensors in turn until one
that works is found. The Allwinner kernel video capture driver has been modified to allow proper unloading and
re-loading (unloading used to hang and crash with the manufacturer's code), and to detect the sensor synchronously at
load time (as opposed to delegating detection to a kernel thread).

- Currently, the order of detection is: sensor specified in \b BOOT:sensor or ov9650 if there is no \b BOOT:sensor file,
ov7725, ov2640, ar0135, ov9650. You will see one orange LED flash for each sensor that the JeVois smart camera tries
to detect at boot up. Once the correct sensor is found, the LED will turn solid orange after a few seconds.

- Global JeVois parameter \p camerasens allows one to know which sensor is installed. Just type:
\verbatim
getpar camerasens
\endverbatim
in the JeVois Inventor console to get the value.

- New deep networks:
+ MnasNet optimized autoML networks supported in \jvmod{TensorFlowEasy}
+ inception_v1_224_quant_20181026 high accuracy (but slow) network supported in \jvmod{TensorFlowEasy}
+ new parameter \p model in \jvmod{DetectionDNN} to allow one to select a network easily at runtime,
without needing to edit the module's \b params.cfg file.

- Improved ov2640 image capture for low resolutions (CIF and lower). The captured images at low-resolution previously
were very dark and zoomed-in compared to higher resolutions. This is now fixed. This is true hardware CIF (plus
DSP-based scaling down for even lower resolutions), so it supports the hardware-advertized max frame rate of 60fps (as
opposed to approaches used in other drivers found on the web which capture at VGA with max 30fps and then use the
on-board DSP to scale down).

- For C++ programmers: new Parameter<T>::reset() resets a parameter to its default value.

*/
20 changes: 19 additions & 1 deletion doc/Sensors.dox
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ This requires some skills but can be done in less than 5 minutes. See the video
JeVois smart camera configuration
---------------------------------

\note With JeVois software \jvversion{1.14} and later, this is optional: the sensor type is automatically detected
at start up. But you may still want to select it as described below, as this will accelerate the JeVois start up time a
bit, by avoiding that JeVois tries all known sensors one after the other.

To let your JeVois smart camera know that you have installed a new sensor, you need to indicate the sensor's name in a
special configuration file on the microSD of your JeVois unit.

Expand All @@ -62,7 +66,17 @@ For example (after installing an ov7725 sensor):

- \b Linux: `echo ov7725 > /media/${USER}/BOOT/sensor`
- \b Mac: `echo ov7725 > /Volumes/BOOT/sensor`
- \b Windows: use TextEdit to create and save the file.
- \b Windows: use Notepad to create and save the file. Make sure there is no extension
(i.e., it is named \a sensor and not <em>sensor.txt</em>).

Which sensor does my JeVois camera have?
----------------------------------------

In the Console of JeVois Inventor, type:

\code{.py}
getpar camerasens
\endcode

Sensor specific information
===========================
Expand Down Expand Up @@ -199,6 +213,10 @@ This sensor supports: YUYV, BAYER, RGB565
+ QQCIF ( 88 x 72): up to 60 fps


\note The housing for this sensor is 1mm larger than for the ov9650 and ov7725. Hence, the case of your JeVois smart
caera will not fully close in the front after this sensor is installed. This is to be expected, there will be an
approximately 1mm gap between the top and bottom of the plastic JeVois camera case.

Which one is which?
-------------------

Expand Down
1 change: 1 addition & 0 deletions doc/Versions.dox
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
- \subpage Change111log
- \subpage Change112log
- \subpage Change113log
- \subpage Change114log

*/
2 changes: 1 addition & 1 deletion doc/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "JeVois"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.12
PROJECT_NUMBER = 1.14

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
6 changes: 6 additions & 0 deletions include/jevois/Component/Parameter.H
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ namespace jevois

//! Unfreeze this parameter, it becomes read-write and will show up in the help message
void unFreeze();

//! Reset this parameter to its default value
virtual void reset() = 0;

protected:
mutable boost::shared_mutex itsMutex; //!< Mutex to protect the parameter value
Expand Down Expand Up @@ -214,6 +217,9 @@ namespace jevois
//! Get summary info about this parameter
virtual ParameterSummary const summary() const override;

//! Reset this parameter to its default value
virtual void reset() override;

//! Change the ParameterDef of this parameter
/*! Use with caution, only people who know what they are doing should use this function. Its thread safety and
possible side effects are dubious. */
Expand Down
5 changes: 5 additions & 0 deletions include/jevois/Component/details/ParameterImpl.H
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ void jevois::ParameterCore<T>::changeParameterDef(jevois::ParameterDef<T> const
*(const_cast<jevois::ParameterDef<T> *>(& itsDef)) = def;
}

// ######################################################################
template <typename T> inline
void jevois::ParameterCore<T>::reset()
{ jevois::ParameterCore<T>::set(itsDef.defaultValue()); }

// ######################################################################
template <typename T> inline
void jevois::ParameterCore<T>::callbackInitCall()
Expand Down

0 comments on commit 99e82a3

Please sign in to comment.