Can I compare image against two images?
Opened this issue · 0 comments
saturday1 commented
I want to do this:
- First, compare imageC with imageA (true/false)
- if it is false, then compare imageC with imageB (true/false)
Is that possible within this function?
if (jQuery('.portlet-queryRecordSearchResult').length) {
jQuery('.arena-record-cover a img').each(function(){
var thisImage = jQuery(this),
thisImageUrl = thisImage.attr('src'),
sameImage = false,
rembrandt = new Rembrandt({
imageA: '/documents/15189/0/portletResources01.jpg',
imageB: '/documents/15189/0/portletResources02.jpg',
imageC: thisImageUrl,
// Needs to be one of Rembrandt.THRESHOLD_PERCENT or Rembrandt.THRESHOLD_PIXELS
thresholdType: Rembrandt.THRESHOLD_PERCENT,
// The maximum threshold (0...1 for THRESHOLD_PERCENT, pixel count for THRESHOLD_PIXELS
maxThreshold: 0,
// Maximum color delta (0...255):
maxDelta: 20,
// Maximum surrounding pixel offset
maxOffset: 0
})
function isSameImage(sameImage) {
if (sameImage) {
thisImage.css('border', '2px solid red');
} else {
console.log('nope');
}
}
// Run the comparison
rembrandt.compare()
.then(function (result) {
isSameImage(result.passed)
})
});
}