Skip to content
Merged
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: 3 additions & 0 deletions modules/xphoto/src/inpainting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ namespace xphoto
/** Writing result **/
for (size_t i = 0; i < labelSeq.size(); ++i)
{
if (pPath[i].x >= img.cols || pPath[i].y >= img.rows)
continue;

cv::Vec <float, cn> val = pointSeq[i][labelSeq[i]];
img.template at<cv::Vec <float, cn> >(pPath[i]) = val;
}
Expand Down
6 changes: 6 additions & 0 deletions modules/xphoto/src/photomontage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ template <typename Tp> void Photomontage <Tp>::
setWeights(GCGraph <TWeight> &graph, const int idx1, const int idx2,
const int l1, const int l2, const int lx)
{
if ((size_t)idx1 >= pointSeq.size() || (size_t)idx2 >= pointSeq.size()
|| (size_t)l1 >= pointSeq[idx1].size() || (size_t)l1 >= pointSeq[idx2].size()
|| (size_t)l2 >= pointSeq[idx1].size() || (size_t)l2 >= pointSeq[idx2].size()
|| (size_t)lx >= pointSeq[idx1].size() || (size_t)lx >= pointSeq[idx2].size())
return;

if (l1 == l2)
{
/** Link from A to B **/
Expand Down