Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ov7670/object_sensor/include/internal/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
extern "C" {
#endif // __cplusplus

#define MAX_OBJECTS_N 8

typedef struct ImageDescription
{
Expand Down Expand Up @@ -43,7 +44,7 @@ typedef struct Target

typedef struct TargetLocation
{
Target target[8];
Target target[MAX_OBJECTS_N];
} TargetLocation;


Expand Down
2 changes: 2 additions & 0 deletions ov7670/object_sensor/include/internal/module_rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ typedef struct RCConfig // what user wants to set
const char* m_fifoInput;
const char* m_fifoOutput;
bool m_videoOutEnable;
int m_objectsN;
} RCConfig;

typedef struct RCInput
Expand All @@ -41,6 +42,7 @@ typedef struct RCInput

bool m_videoOutParamsUpdated;
bool m_videoOutEnable;
int m_objectsN;
} RCInput;


Expand Down
2 changes: 1 addition & 1 deletion ov7670/object_sensor/src/module_ce.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static int do_transcodeFrame(CodecEngine* _ce,
memcpy(_dstFramePtr, _ce->m_dstBuffer, *_dstFrameUsed);


memcpy(&(_targetLocation->target[0]), &(tcOutArgs.alg.target[0]), sizeof(Target));
memcpy(_targetLocation->target, tcOutArgs.alg.target, MAX_OBJECTS_N*sizeof(Target));
/*
_targetLocation->m_targetX = tcOutArgs.alg.target[0].x;
_targetLocation->m_targetY = tcOutArgs.alg.target[0].y;
Expand Down
9 changes: 8 additions & 1 deletion ov7670/object_sensor/src/module_rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ int rcInputOpen(RCInput* _rc, const RCConfig* _config)
_rc->m_fifoInputReadBuffer = malloc(_rc->m_fifoInputReadBufferSize);

_rc->m_videoOutEnable = _config->m_videoOutEnable;
_rc->m_objectsN = _config->m_objectsN < MAX_OBJECTS_N ? (_config->m_objectsN > 0 ? _config->m_objectsN : 1 ) : MAX_OBJECTS_N;
return 0;
}

Expand Down Expand Up @@ -483,7 +484,13 @@ int rcInputUnsafeReportTargetLocation(RCInput* _rc, const TargetLocation* _targe
return EINVAL;

if (!_rc->m_fifoOutputFd != -1)
dprintf(_rc->m_fifoOutputFd, "loc: %d %d %d\n", _targetLocation->target[0].x, _targetLocation->target[0].y, _targetLocation->target[0].size);
if(_rc->m_objectsN == 1)
dprintf(_rc->m_fifoOutputFd, "loc: %d %d %d\n", _targetLocation->target[0].x, _targetLocation->target[0].y, _targetLocation->target[0].size);
else {
for(int i = 0; i < _rc->m_objectsN; ++i) {
dprintf(_rc->m_fifoOutputFd, "loc%d: %d %d %d\n", i, _targetLocation->target[i].x, _targetLocation->target[i].y, _targetLocation->target[i].size);
}
}

return 0;
}
Expand Down
Binary file modified ov7670/object_sensor/src/object_sensor_arm
Binary file not shown.
10 changes: 6 additions & 4 deletions ov7670/object_sensor/src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ bool runtimeParseArgs(Runtime* _runtime, int _argc, char* const _argv[])
{ "rc-fifo-in", 1, NULL, 0 }, // 7
{ "rc-fifo-out", 1, NULL, 0 },
{ "video-out", 1, NULL, 0 },
{ "objects-n", 1, NULL, 0 }, //10
{ "verbose", 0, NULL, 'v' },
{ "help", 0, NULL, 'h' },
{ NULL, 0, NULL, 0 }
Expand Down Expand Up @@ -113,10 +114,10 @@ bool runtimeParseArgs(Runtime* _runtime, int _argc, char* const _argv[])
break;
case 6: cfg->m_fbConfig.m_path = optarg; break;

case 7 : cfg->m_rcConfig.m_fifoInput = optarg; break;
case 7+1: cfg->m_rcConfig.m_fifoOutput = optarg; break;
case 7+2: cfg->m_rcConfig.m_videoOutEnable = atoi(optarg); break;

case 7 : cfg->m_rcConfig.m_fifoInput = optarg; break;
case 8: cfg->m_rcConfig.m_fifoOutput = optarg; break;
case 9: cfg->m_rcConfig.m_videoOutEnable = atoi(optarg); break;
case 10: cfg->m_rcConfig.m_objectsN = atoi(optarg); break;
default:
return false;
}
Expand Down Expand Up @@ -152,6 +153,7 @@ void runtimeArgsHelpMessage(Runtime* _runtime, const char* _arg0)
" --rc-fifo-in <remote-control-fifo-input>\n"
" --rc-fifo-out <remote-control-fifo-output>\n"
" --video-out <enable-video-output>\n"
" --objects-n <set objects amount to trace (1-8)>\n"
" --verbose\n"
" --help\n",
_arg0);
Expand Down
2 changes: 1 addition & 1 deletion release/ov7670/object-sensor-ov7670.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#object-sensor-ov7670 default opts
VIDEO_PORT=0
VIDEO_PATH=/dev/video$VIDEO_PORT
DEFAULT_OPS='--v4l2-path=$VIDEO_PATH'
DEFAULT_OPS="--objects-n=1 --v4l2-path=$VIDEO_PATH"