小编SAM*_*HOD的帖子

如何从ios中的源图像改变脸部的肤色?

我的代码:如何管理不同色调的脸部的RGB值,以及如何应用?这段代码会改变脸部的颜色和头发,但我想1.只是面部除了头发的颜色.

    -(void)changeSkinColorValue:(float)value WithImage:(UIImage*)needToModified
    {

        CGContextRef ctx;

        CGImageRef imageRef = needToModified.CGImage;
        NSUInteger width = CGImageGetWidth(imageRef);
        NSUInteger height = CGImageGetHeight(imageRef);
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
        //unsigned char *rawData = malloc(firstImageV.image.size.height * firstImageV.image.size.width * 10);

        CFMutableDataRef m_DataRef = CFDataCreateMutableCopy(0, 0,CGDataProviderCopyData(CGImageGetDataProvider(firstImageV.image.CGImage)));
        UInt8 *rawData = (UInt8 *) CFDataGetMutableBytePtr(m_DataRef);
        int length = CFDataGetLength(m_DataRef);
        NSUInteger bytesPerPixel = 4;
        NSUInteger bytesPerRow = bytesPerPixel * firstImageV.image.size.width;
        NSUInteger bitsPerComponent = 8;

                CGContextRef context1 = CGBitmapContextCreate(rawData, firstImageV.image.size.width, firstImageV.image.size.height, bitsPerComponent, bytesPerRow, colorSpace,                     kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
        CGColorSpaceRelease(colorSpace);

        CGContextDrawImage(context1, CGRectMake(0, 0, firstImageV.image.size.width, firstImageV.image.size.height), imageRef);

        NSLog(@"%d::%d",width,height); …
Run Code Online (Sandbox Code Playgroud)

iphone ios xcode4.2

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

在imageview中调整线条以适应我们的头部

我正在开发一个与HairTryOn相同的应用程序.但问题在下图中显示.我想根据客户脸部设置发型,使用蓝线按照图像显示.我使用以下代码

    testVw = [[UIView alloc]initWithFrame:CGRectMake(100,100, 100, 100)];
    testVw.backgroundColor = [UIColor clearColor];
    [self.view addSubview:testVw];    


    resizeVw = [[UIImageView    alloc]initWithFrame:CGRectMake(testVw.frame.size.width-25, testVw.frame.size.height-25, 25, 25)];
    resizeVw.backgroundColor = [UIColor clearColor];
    resizeVw.userInteractionEnabled = YES;
    resizeVw.image = [UIImage imageNamed:@"button_02.png" ];

    [testVw addSubview:resizeVw];

    UIPanGestureRecognizer* panResizeGesture = [[UIPanGestureRecognizer alloc] 
    initWithTarget:self action:@selector(resizeTranslate:)];

    [testVw addGestureRecognizer:panResizeGesture];
Run Code Online (Sandbox Code Playgroud)

resizeTranslate:方法:

-(void)resizeTranslate:(UIPanGestureRecognizer *)recognizer
{
        if ([recognizer state]== UIGestureRecognizerStateBegan) 
        {
            prevPoint = [recognizer locationInView:testVw.superview];
            [testVw setNeedsDisplay];
        }
        else if ([recognizer state] == UIGestureRecognizerStateChanged)
        {
            if (testVw.bounds.size.width < 20)
            {

                testVw.bounds = CGRectMake(testVw.bounds.origin.x, testVw.bounds.origin.y, 20,testVw.bounds.size.height);
                imgvw.frame = …
Run Code Online (Sandbox Code Playgroud)

iphone bezier uiimageview ios uibezierpath

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

如何使用可点击的第一个单词创建UILabel

我想在iOS中创建标签,任何人都可以帮助我使标签文本的第一个单词加粗和可点击.标签显示用户名及其注释,第一个单词始终是用户名.提前致谢!

iphone objective-c uilabel ipad ios

7
推荐指数
2
解决办法
9114
查看次数

人体测量身高,体重等部位

我正在开发一个裁缝的应用程序,我想测量它的布料的人体大小.看到图片

在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述

在所有测量后它显示结果如...

在此输入图像描述

这可能吗?我搜索Google Width and Height of Human Body以及其他SO.如果这种类型的应用程序的任何示例真的很感激.

iphone objective-c uiimageview ios

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

如何将uiview从左向右移动,反之亦然

嗨我正在开发一个应用程序.在那个我做了一个视图的动画从左到右和从右到左移动并更改该视图中包含的标签的值.但是当我点击向左或向右按​​钮时该视图被删除新视图覆盖旧视图.所以我不想覆盖.我想添加新视图.我的代码是

    -(void)centerAnimation1:(id)sender
     {
         UIView *currentView = daysview;
            theWindow = daysview;
         // set up an animation for the transition between the views
        CATransition *animation = [CATransition animation];
            animation.delegate = self;
        [animation setDuration:0.4];
        [animation setType:kCATransitionMoveIn];

         if(rhtolft)
         {
             [animation setSubtype:kCATransitionFromLeft];
         }
         else
         {
             [animation setSubtype:kCATransitionFromRight];
         }
        [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
        [[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
            [currentView removeFromSuperview];
        }


        - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{

             if(animate)
             {
                 CATransition *animation = [CATransition animation];
                 animation.delegate = self;
                 [animation setDuration:0.4];
                 [animation setType:kCATransitionMoveIn];
                 if(rhtolft)
                 {
                     [animation setSubtype:kCATransitionFromLeft];
                     rhtolft=NO;
                 }
                 else
                 {
                     [animation …
Run Code Online (Sandbox Code Playgroud)

iphone ios

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

AVAssetWriter startWriting状态为3时无法调用方法

我正在使用视频过滤.我使用了BradLarson的 GPUImage.它完美的图像工作,但现在我试图从库过滤视频文件,它给我错误[AVAssetWriter startWriting] Cannot call method when status is 3.我用过IOS7

heare是我的代码

- (void)viewDidLoad
{
    [super viewDidLoad];
    videoEditingPlayView = [[GPUImageView alloc] initWithFrame:CGRectMake(60,108,200,200)];

    [self.view addSubview:videoEditingPlayView];
}

-(IBAction)btnEffectsClick:(id)sender{
     NSURL *videoURl = [NSURL fileURLWithPath:self.strVideoURl];
    if (movieFile != nil) {
        videoFilter = nil;
       movieFile = nil;
     }
movieFile = [[GPUImageMovie alloc] initWithURL:videoURl];
movieFile.runBenchmark = YES;
videoFilter = [[GPUImageBrightnessFilter alloc] init];
[(GPUImageBrightnessFilter *)videoFilter setBrightness:0.0];
[movieFile addTarget:videoFilter];
videoEditingPlayView.hidden = NO;

GPUImageView *filterView = (GPUImageView *)videoEditingPlayView;
[videoFilter addTarget:filterView];

NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
NSURL *movieURL …
Run Code Online (Sandbox Code Playgroud)

video-processing ios gpuimage

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

随机调用一个方法

我在课堂上有7种方法.当我收到一条特定的消息时,我必须从这7种方法中随机调用一种方法.我的示例代码是:

-(void)poemAbcd{

    UIImage *image = [UIImage imageNamed: @"abcd_bg.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:80 with:220];
}

-(void)poemHumptyDumpty{

    UIImage *image = [UIImage imageNamed: @"humpty_dumpty.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:80 with:170];
}

-(void)poemBlackship{

    UIImage *image = [UIImage imageNamed: @"black_sheep.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:66 with:229];
}

-(void)poemRowRow{

    UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:144 with:211];
}

-(void)poemHappy{

    UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:144 with:211];
}

-(void)poemItsyBitsy{

    UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
    [backgroundImage setImage:image];

    [self changeMumuPosition:144 with:211];
}

-(void)poemTwinkleTwinkle{ …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

在NSMutalbleArray的本地搜索

我想搜索 NSMutalbleArray,我的代码是:

    arrCelebs=[[NSMutableArray alloc] initWithObjects:@"Test 1",@"Test 2",@"Test 42",@"Test 5", nil];

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

    NSString *arrString1 = txtSearch.text;
    NSRange tmprange;
    for(NSString *string in arrCelebs) {
            tmprange = [arrString1 rangeOfString:string];
            if (tmprange.location != NSNotFound) {
                     NSLog(@"String found");
                    break;
            }
    }
    return YES;
    }
Run Code Online (Sandbox Code Playgroud)

如果我输入"t"然后它搜索所有数据,我想添加另一个数组.用于在tableview中显示.

iphone objective-c ios

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

基于不区分大小写的子串拆分字符串

我需要根据单词拆分字符串.该单词可以是任何Case,我需要保留子字符串数组的大小写.例:

  1. 字符串可能是
    a)"我的名字是XYZ,我住在ABC." 或
    b)"我的名字是XYZ,我住在ABC." 或者
    c)"我的名字是XYZ,我住在ABC."
  2. 现在,分离串可以是"和"或"和"或"和".
  3. 在我的代码中,我不知道在a),b)和c)中使用了哪个字符串.
  4. 问题是如何将字符串分隔为"我的名字是XYZ"和"我住在ABC".分别.

iphone xcode ipad ios

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