我试图在图像中找到文本的边界框,目前正在使用这种方法:
// calculate the local variances of the grayscale image
Mat t_mean, t_mean_2;
Mat grayF;
outImg_gray.convertTo(grayF, CV_32F);
int winSize = 35;
blur(grayF, t_mean, cv::Size(winSize,winSize));
blur(grayF.mul(grayF), t_mean_2, cv::Size(winSize,winSize));
Mat varMat = t_mean_2 - t_mean.mul(t_mean);
varMat.convertTo(varMat, CV_8U);
// threshold the high variance regions
Mat varMatRegions = varMat > 100;
Run Code Online (Sandbox Code Playgroud)
给出这样的图像时:
然后,当我显示varMatRegions
我得到这个图像:
正如你所看到的那样,它将左侧的文本块与卡片的标题结合起来,对于大多数卡片而言,这种方法效果很好,但在较繁忙的卡片上它可能会导致问题.
这些轮廓连接不好的原因是它使得轮廓的边界框几乎占据了整个卡片.
任何人都可以建议一种不同的方式来查找文本以确保正确检测文本吗?
200分,谁能在这两张卡上方找到文字.
I developed a React Native module (wrapping an SDK) and I’m interested in creating some unit tests using mocha. I’m not very familiar with mocha, but I can’t exactly figure out how to proceed.
I have my react native module, call it react-native-mymodule
which I can use in an app by doing:
npm install react-native-mymodule
react-native link react-native-mymodule
Then I can import my module with:
import MySDK from "react-native-mymodule”;
I’m trying to do a similar thing with unit tests. In …
我正在尝试在我的iOS程序中实现自动透视校正,当我使用我在教程中找到的测试图像时,一切都按预期工作.但是当我拍照时,我得到了一个奇怪的结果.
我正在使用本教程中的代码
当我给它一个看起来像这样的图像:
我得到了这个结果:
以下是dst
给我带来帮助的原因.
我用它来调用包含代码的方法.
quadSegmentation(Img, bw, dst, quad);
当我从教程中获得如此多的绿线时,有人能告诉我吗?我怎么能够解决这个问题并正确裁剪图像只包含卡?
如果我有一个被调用的图像inImg
和一个名为" outImg
如何调整大小" 的图像outImg
,那么它的大小是75%inImg
?
我试图通过将图像(帧)组合成一个图像并通过基于预设的alpha执行操作来模拟长曝光照片.我在iPhone上这样做,我目前将视频长度设置为1秒(30帧).alpha被设置为1.0/frameCount
然而我在30中硬编码以代表30 FPS视频捕获的一秒.一旦达到一秒视频/ 30帧,我就停止操作.这个想法是用户可以设置一个x秒的计时器,我将做数学计算,以确定允许多少帧.
这是我正在使用的代码:
- (void)processImage:(Mat&)image
{
if (_isRecording) {
// first frame
double alpha = 1.0/30;
if (_frameCount == 0) {
_exposed = image;
_frameCount++;
} else {
Mat exposed = _exposed.clone();
addWeighted(exposed, alpha, image, 1.0 - alpha, 0.0, _exposed);
_frameCount++;
}
// stop and save image
if (_frameCount == 30) {
_isRecording = NO;
_frameCount = 0;
cvtColor(_exposed, _exposed, CV_BGRA2RGB, 30);
UIImage *exposed = [LEMatConverter UIImageFromCVMat:_exposed];
UIImageWriteToSavedPhotosAlbum(exposed, nil, nil, nil);
NSLog(@"saved");
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行这段代码时,我基本上会找回一张看起来好像是单帧的静止图像.这是一个例子:
有谁知道如何从视频帧产生长曝光图像的预期效果我知道会有多少帧?
当用户接近停止时,我试图获取总线的到达时间,我已经测试通过发送基本的本地通知来确保区域被正确触发,我还测试了我的Web服务调用以确保它正常工作.
但是我很难获取信息,然后发送通知.
这是我的代码:
var bgTask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier()
bgTask = UIApplication.shared().beginBackgroundTask {
self.webService?.getStopEstimates(routeStopIds: stopRouteIdSet, routeNameDict: routeNameDict, completion: { (result) in
if result == "error" {
return
}
let notification = UILocalNotification()
notification.fireDate = Date(timeIntervalSinceNow: 1)
notification.alertTitle = region.identifier + " Stop Details"
notification.alertBody = result
notification.soundName = UILocalNotificationDefaultSoundName
UIApplication.shared().scheduleLocalNotification(notification)
})
UIApplication.shared().endBackgroundTask(bgTask)
}
Run Code Online (Sandbox Code Playgroud)
任何人都明白为什么它可能不会发送?我启用了后台提取和位置服务.这是在里面didEnterRegion
我正在使用Apple Music测试我的应用程序,我的应用程序抓取当前播放的歌曲并在其上显示相关信息.
其中一个步骤是获取专辑封面,但我发现当歌曲从Apple Music播放时,它不包含任何艺术作品.
这是我的代码,第一个if条件运行,这表明艺术品已初始化,但我没有得到图像.
有没有人知道如何通过Apple Music播放歌曲时获得艺术作品?
song
是类型的 MPMediaItem
CGSize artworkImageViewSize = cell.albumImage.bounds.size;
MPMediaItemArtwork *artwork = [song valueForProperty:MPMediaItemPropertyArtwork];
if (artwork)
{
cell.albumImage.image = [artwork imageWithSize:artworkImageViewSize];
}
else
{
cell.albumImage.image = [UIImage imageNamed:@"noArtwork"];
}
Run Code Online (Sandbox Code Playgroud)
每当我尝试打印时,artwork.bounds
我都会返回null.
我一直在使用NSDataDetector
解析字符串的地址,并且大部分它做得很好.然而,在地址'类似于这个地方它没有检测到它.
6200 North Evan Blvd Suit 487 Highland UT 84043
目前我正在使用此代码:
NSError *error = nil;
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeAddress error:&error];
NSArray *matches = [detector matchesInString:output options:0 range:NSMakeRange(0, [output length])];
for (NSTextCheckingResult *match in matches) {
if ([match resultType] == NSTextCheckingTypeAddress) {
_address = [_tesseractData substringWithRange:[match range]];
NSDictionary *data = [match addressComponents];
_zip = [data objectForKey:@"ZIP"];
if (_zip) {
NSRange zipRange = [_tesseractData rangeOfString:_zip];
if (zipRange.location != NSNotFound) {
[_tesseractData deleteCharactersInRange:zipRange];
}
}
_city = [data objectForKey:@"City"];
if …
Run Code Online (Sandbox Code Playgroud) 我正在尝试捕获由node.js中的Aftership API发出的PUT/webhook请求.每次需要推送通知时都会发出PUT请求,我正在使用Parse发送通知,但我需要来自webhook的一些数据.
webhook的标题看起来像Content-Type: application/json
并包含这些数据:
ts - 事件发生的UTC unix时间戳
event - 事件的名称(对于跟踪更新,值将为'tracking_update')
msg - 有关事件发生的消息的详细信息,格式如下.
我如何获取token
节点或js中自定义字段字典中的跟踪号,slug和值?
{
"event": "tracking_update",
"msg": {
"id": "53aa94fc55ece21582000004",
"tracking_number": "906587618687",
"title": "906587618687",
"origin_country_iso3": null,
"destination_country_iso3": null,
"shipment_package_count": 0,
"active": false,
"order_id": null,
"order_id_path": null,
"customer_name": null,
"source": "web",
"emails": [],
"custom_fields": {},
"tag": "Delivered",
"tracked_count": 1,
"expected_delivery": null,
"signed_by": "D Johnson",
"shipment_type": null,
"tracking_account_number": null,
"tracking_postal_code": "DA15BU",
"tracking_ship_date": null,
"created_at": "2014-06-25T09:23:08+00:00",
"updated_at": "2014-06-25T09:23:08+00:00",
"slug": "dx",
"unique_token": "xk7LesjIgg",
"checkpoints": [{
"country_name": null,
"country_iso3": …
Run Code Online (Sandbox Code Playgroud) 我正在尝试这个 C库.我已将文件添加到我的项目中,并创建了一个Objective-C文件以跟随github页面上的示例.我已经在我的桥接头中导入了Objc文件,但是当我编译时我
Ld /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos/trinkeSwift.app/trinkeSwift normal arm64
cd /Users/nickporter/Developer/trinkeSwift
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -L/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos -F/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos -filelist /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift.swiftmodule -miphoneos-version-min=8.0 -framework CoreGraphics -framework Foundation -framework UIKit -Xlinker -dependency_info -Xlinker /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift_dependency_info.dat -o /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos/trinkeSwift.app/trinkeSwift
duplicate symbol _str_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _mymodifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _fromModifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _timePointer in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _temp_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _set_time …
Run Code Online (Sandbox Code Playgroud) ios ×6
c++ ×4
opencv ×4
objective-c ×3
javascript ×2
swift ×2
bounding-box ×1
c ×1
mocha.js ×1
mpmediaitem ×1
node.js ×1
put ×1
react-native ×1
reactjs ×1
resize ×1
text ×1
webhooks ×1