小编Sr.*_*hie的帖子

OpenCV:阈值和反转图像

我正在尝试使用 Cinder OpenCV 块阈值和反转图像。在 openFrameworks 中,我会使用类似的东西:

someImage.threshold(230, true);
Run Code Online (Sandbox Code Playgroud)

...其中 true 是指定阈值和反转的参数。

在 Cinder 中,我正在尝试以下操作:

cv::threshold (input, threshNear, 230, 255, CV_THRESH_BINARY_INV);     
Run Code Online (Sandbox Code Playgroud)

...这不起作用,或者

cv::threshold (input, threshNear, 100, 255, CV_8U);
cv::invert ( threshNear,  threshNearInverted);
Run Code Online (Sandbox Code Playgroud)

...产生错误并让程序卡住。

有什么建议吗?

c++ opencv cinder

3
推荐指数
1
解决办法
3万
查看次数

actionscript 3 event.target

我有一个名为button1的影片剪辑,在这个影片剪辑中有一个名为txt的动态文本

 public function mouse_down(event:MouseEvent)
      {
      if(event.target==button1)
      {
      ...//this only recognizes when i click the button without intersecting the dynamic text area
      }
      if(event.target==button1||event.target==button1.txt)
      {
      ...//this works
      }
Run Code Online (Sandbox Code Playgroud)

我想知道为什么它不能识别包含动态点击的区域中的点击,如果我没有指定它,因为txt是button1的一部分,所以通常我只需要检查目标是否是button1但是它不起作用:我还必须检查目标是否是button1.txt

谢谢你的帮助!

events actionscript-3 target movieclip

2
推荐指数
1
解决办法
8897
查看次数

检测耳机是否已插入 - iOS 5

我知道这是一个已经问过的问题,我发现可能有重复:

检测耳机是否插入iPhone

音频路由不变时耳机插件插件事件 - iOS

检测耳机(非麦克风)是否已插入iOS设备

...以及有关WWW的更多信息.但是我已经尝试了每个解决方案,每次我遇到问题时,可能是因为它们是旧线程并且指的是iOS 4.如何在iOS 5.0上检测到它?谢谢

objective-c headset ios

2
推荐指数
1
解决办法
3217
查看次数

UIPageViewController不会更改页面

我有一个视图控制器实现UIPageViewControllerDataSource委托,它包含一个UIPageViewController.

我的问题是,经过3个小时的教程和阅读后,我仍然不明白为什么UIPageController会通过移动它的内容来对刷卡作出反应,但如果滚动就足够了,它就不会改变页面.它始终停留在第一页.

所以这是我的.h文件

#import <UIKit/UIKit.h>
@interface BreathePageViewController : UIViewController <UIPageViewControllerDataSource> 
@property (strong, nonatomic) UIPageViewController *pageController;
@end
Run Code Online (Sandbox Code Playgroud)

这是我的.m文件

#import "BreathePageViewController.h"
#import "FirstViewController.h"
#import "SecondViewController.h.h"



@interface BreathePageViewController () {
    NSArray *pageViewControllerScreens;
    FirstViewController *firstViewController;
    SecondViewController *secondViewController;
    int pageIndex;
}

@end

@implementation BreathePageViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    pageIndex = 0;
    self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

    self.pageController.dataSource = self;
    [[self.pageController view] setFrame:[[self …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios uipageviewcontroller

2
推荐指数
1
解决办法
1477
查看次数

用于展平多维数组的功能

var flatten = function (array){
  // TODO: Program me
  var newArray = [];
  for(var i = 0; i<array.length; i++) {
    newArray.push(array[i]);
  }
  return newArray;
}
Run Code Online (Sandbox Code Playgroud)

这是结果除外:

flatten([1,2,3]) // => [1,2,3]
flatten([[1,2,3],["a","b","c"],[1,2,3]])  // => [1,2,3,"a","b","c",1,2,3]
flatten([[[1,2,3]]]) // => [[1,2,3]]

Test result:

Test Passed

Test Passed

Test Failed: Value is not what was expected
Run Code Online (Sandbox Code Playgroud)
  1. 我在"专业JS for Web Developers"中搜索了一些heliping函数,但我找不到一个用于查找数组维数的函数.

javascript jagged-arrays

2
推荐指数
1
解决办法
4236
查看次数

express.js和angular.js之间的区别在哪里?

我是JavaScript服务器开发的新手.我认出了"卑鄙"的堆栈.MongoDB,Express.js,Angular.js和node.js. express.js和anguar.js之间的区别在哪里,我是否需要同时使用两者?

javascript frameworks node.js angularjs

2
推荐指数
1
解决办法
2010
查看次数

单选按钮上的空格键和箭头键触发TypeError:错误#1009

我刚刚在我的应用程序中发现了一个错误,它看起来像一个Flash播放器错误,我想知道是否有人找到了解决方法或其他东西.

我的应用程序中有一些单选按钮组.如果我按住空格键的同时按下箭头键,它会结束触发

  TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at fl.controls::LabelButton/drawIcon()
    at fl.controls::LabelButton/draw()
    at fl.controls::RadioButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
Run Code Online (Sandbox Code Playgroud)

如果发现这个线程描述了我的相同情况.你认为这有什么办法吗?它真的是一个flash bug吗?

air actionscript-3

1
推荐指数
1
解决办法
740
查看次数

UIButton帧大小始终为零

所以我可能遗漏了一些显而易见的东西,但是我无法获得在我的中创建的UIButton的正确尺寸

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

功能:

callerPlayerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[callerPlayerBtn setImage:[UIImage imageNamed:@"callPlayerBtn"] forState:UIControlStateNormal];
[self.view addSubview:callerPlayerBtn];   
NSLog(@"SIZES ARE %f %f", callerPlayerBtn.bounds.size.width, callerPlayerBtn.bounds.size.height);
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?日志总是如此0.我想访问它的维度来集中它.谢谢

objective-c ios

0
推荐指数
1
解决办法
1173
查看次数

删除键的 ASCII 键码错误

我有一个 HTML 表单,我只需要允许按数字键。为此,我使用了以下代码

    $(".span8").keypress(function(e) 
    {
         var unicode=e.charCode?e.charCode : e.keyCode
     //警报(Unicode);
     if ((unicode ==8) || (unicode==9)|| (unicode==46)){
        //如果键不是退格键(我们应该允许)
     }
     别的
     {
         if (unicode<48||unicode>57&&unicode!=65) //如果不是数字
         return false //禁用按键
     }

});

Run Code Online (Sandbox Code Playgroud)

但是在这里,如果我正在测试键码,则删除键的值为 46。46 用于点(-句点)其他值将正确。我无法找到我是不是做错了。请帮忙

javascript ascii keycode

0
推荐指数
1
解决办法
5296
查看次数