Project import generated by Copybara.

GitOrigin-RevId: ff83882955f1a1e2a043ff4e71278be9d7217bbe
This commit is contained in:
MediaPipe Team
2021-05-05 14:56:16 -04:00
committed by chuoling
parent ecb5b5f44a
commit a9b643e0f5
210 changed files with 5312 additions and 3838 deletions
+18
View File
@@ -16,6 +16,7 @@
#import <XCTest/XCTest.h>
#include "absl/memory/memory.h"
#include "mediapipe/framework/formats/image.h"
#import "mediapipe/objc/MPPGraph.h"
#import "mediapipe/objc/MPPGraphTestBase.h"
#import "mediapipe/objc/NSError+util_status.h"
@@ -333,4 +334,21 @@ REGISTER_CALCULATOR(ErrorCalculator);
[self waitForExpectationsWithTimeout:3.0 handler:NULL];
}
- (void)testPixelBufferToImage {
CFHolder<CVPixelBufferRef> pixelBufferIn;
absl::Status status = CreateCVPixelBufferFromCGImage(_sourceImage.CGImage, &pixelBufferIn);
XCTAssert(status.ok());
mediapipe::CalculatorGraphConfig config;
_graph = [[MPPGraph alloc] initWithGraphConfig:config];
mediapipe::Packet packet = [_graph imagePacketWithPixelBuffer:*pixelBufferIn];
CVPixelBufferRef pixelBufferOut = packet.Get<mediapipe::Image>().GetCVPixelBufferRef();
XCTAssertTrue([self pixelBuffer:*pixelBufferIn
isCloseTo:pixelBufferOut
maxLocalDifference:0
maxAverageDifference:0]);
}
@end