Compare commits
No commits in common. "c126add98f57e6235e27a4bad82a907274dd688b" and "521b4156824da46232c1a4844438d21afb13b170" have entirely different histories.
c126add98f
...
521b415682
|
@ -56,5 +56,5 @@
|
||||||
"temp/": true,
|
"temp/": true,
|
||||||
"Temp/": true
|
"Temp/": true
|
||||||
},
|
},
|
||||||
"dotnet.defaultSolution": "SinhNhat.sln"
|
"dotnet.defaultSolution": "Interactive-DOOH.sln"
|
||||||
}
|
}
|
|
@ -807,7 +807,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: -350}
|
m_AnchoredPosition: {x: 0, y: -300}
|
||||||
m_SizeDelta: {x: 900, y: 200}
|
m_SizeDelta: {x: 900, y: 200}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &523800084
|
--- !u!114 &523800084
|
||||||
|
@ -865,7 +865,7 @@ MonoBehaviour:
|
||||||
m_fontSizeMax: 72
|
m_fontSizeMax: 72
|
||||||
m_fontStyle: 1
|
m_fontStyle: 1
|
||||||
m_HorizontalAlignment: 2
|
m_HorizontalAlignment: 2
|
||||||
m_VerticalAlignment: 256
|
m_VerticalAlignment: 512
|
||||||
m_textAlignment: 65535
|
m_textAlignment: 65535
|
||||||
m_characterSpacing: 0
|
m_characterSpacing: 0
|
||||||
m_wordSpacing: 0
|
m_wordSpacing: 0
|
||||||
|
|
|
@ -374,7 +374,6 @@ RectTransform:
|
||||||
- {fileID: 39214309}
|
- {fileID: 39214309}
|
||||||
- {fileID: 1701610192}
|
- {fileID: 1701610192}
|
||||||
- {fileID: 2075871718}
|
- {fileID: 2075871718}
|
||||||
- {fileID: 1934445842}
|
|
||||||
m_Father: {fileID: 1447100632}
|
m_Father: {fileID: 1447100632}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -46.3}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -46.3}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
@ -588,7 +587,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: -350}
|
m_AnchoredPosition: {x: 0, y: -300}
|
||||||
m_SizeDelta: {x: 900, y: 200}
|
m_SizeDelta: {x: 900, y: 200}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &334911201
|
--- !u!114 &334911201
|
||||||
|
@ -647,7 +646,7 @@ MonoBehaviour:
|
||||||
m_fontSizeMax: 72
|
m_fontSizeMax: 72
|
||||||
m_fontStyle: 1
|
m_fontStyle: 1
|
||||||
m_HorizontalAlignment: 2
|
m_HorizontalAlignment: 2
|
||||||
m_VerticalAlignment: 256
|
m_VerticalAlignment: 512
|
||||||
m_textAlignment: 65535
|
m_textAlignment: 65535
|
||||||
m_characterSpacing: 0
|
m_characterSpacing: 0
|
||||||
m_wordSpacing: 0
|
m_wordSpacing: 0
|
||||||
|
@ -2297,81 +2296,6 @@ CanvasRenderer:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1796482200}
|
m_GameObject: {fileID: 1796482200}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1 &1934445841
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1934445842}
|
|
||||||
- component: {fileID: 1934445844}
|
|
||||||
- component: {fileID: 1934445843}
|
|
||||||
m_Layer: 5
|
|
||||||
m_Name: Effect
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 0
|
|
||||||
--- !u!224 &1934445842
|
|
||||||
RectTransform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1934445841}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0.38268343, w: 0.92387956}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 1
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 263418222}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 45}
|
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
|
||||||
m_AnchoredPosition: {x: -87, y: -6}
|
|
||||||
m_SizeDelta: {x: 700, y: 700}
|
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
|
||||||
--- !u!114 &1934445843
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1934445841}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_RaycastTarget: 1
|
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
m_Maskable: 1
|
|
||||||
m_OnCullStateChanged:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
m_Sprite: {fileID: 21300000, guid: 6effafeec1f9b099cb24bd4a39fbd3ae, type: 3}
|
|
||||||
m_Type: 0
|
|
||||||
m_PreserveAspect: 0
|
|
||||||
m_FillCenter: 1
|
|
||||||
m_FillMethod: 4
|
|
||||||
m_FillAmount: 1
|
|
||||||
m_FillClockwise: 1
|
|
||||||
m_FillOrigin: 0
|
|
||||||
m_UseSpriteMesh: 0
|
|
||||||
m_PixelsPerUnitMultiplier: 1
|
|
||||||
--- !u!222 &1934445844
|
|
||||||
CanvasRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1934445841}
|
|
||||||
m_CullTransparentMesh: 1
|
|
||||||
--- !u!1 &1939570963
|
--- !u!1 &1939570963
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -73,22 +73,20 @@ namespace GadGame.Scripts.Coffee
|
||||||
{
|
{
|
||||||
if(!_isLoading) return;
|
if(!_isLoading) return;
|
||||||
_timer += Time.deltaTime;
|
_timer += Time.deltaTime;
|
||||||
// if (_timer >= 3)
|
if (_timer >= 3)
|
||||||
// {
|
|
||||||
// _timer = 0;
|
|
||||||
// _indexText++;
|
|
||||||
// if (_indexText > _loadingTexts.Length - 1)
|
|
||||||
// {
|
|
||||||
// _indexText = 0;
|
|
||||||
// }
|
|
||||||
// _hintText.text = _loadingTexts[_indexText];
|
|
||||||
// }
|
|
||||||
|
|
||||||
Debug.Log(_timer);
|
|
||||||
|
|
||||||
if(UdpSocket.Instance.DataReceived.Gender != null && _timer > 3)
|
|
||||||
{
|
{
|
||||||
_notifyText.text = UdpSocket.Instance.DataReceived.Gender == "Male" ? "Hmmm, để xem kiếp trước bạn là ai nào, chàng trai" : "Hmmm, để xem kiếp trước bạn là ai nào, cô gái";
|
_timer = 0;
|
||||||
|
_indexText++;
|
||||||
|
if (_indexText > _loadingTexts.Length - 1)
|
||||||
|
{
|
||||||
|
_indexText = 0;
|
||||||
|
}
|
||||||
|
// _hintText.text = _loadingTexts[_indexText];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UdpSocket.Instance.DataReceived.AgeMax != 0)
|
||||||
|
{
|
||||||
|
_notifyText.text = UdpSocket.Instance.DataReceived.Gender < 0.5 ? "Hmmm, để xem kiếp trước bạn là ai nào, chàng trai" : "Hmmm, để xem kiếp trước bạn là ai nào, cô gái";
|
||||||
} else {
|
} else {
|
||||||
_notifyText.text = "Khuấy đều tay, kiếp trước của bạn sẽ hiện ra, chờ một chút nhé";
|
_notifyText.text = "Khuấy đều tay, kiếp trước của bạn sẽ hiện ra, chờ một chút nhé";
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace GadGame.Network
|
||||||
public bool OnVision;
|
public bool OnVision;
|
||||||
public bool Engage;
|
public bool Engage;
|
||||||
public bool Ready;
|
public bool Ready;
|
||||||
public string Gender;
|
public float Gender;
|
||||||
public int AgeMin;
|
public int AgeMin;
|
||||||
public int AgeMax;
|
public int AgeMax;
|
||||||
// public Vector2[] PosPoints;
|
// public Vector2[] PosPoints;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class QRShow : MonoBehaviour
|
||||||
_voucherAnimator.SetBool("FadeOut", true);
|
_voucherAnimator.SetBool("FadeOut", true);
|
||||||
_qrAnimator.SetBool("ZoomIn", true);
|
_qrAnimator.SetBool("ZoomIn", true);
|
||||||
_notifyAnimator.SetBool("FadeIn", true);
|
_notifyAnimator.SetBool("FadeIn", true);
|
||||||
_notifyAnimator.SetBool("Male", UdpSocket.Instance.DataReceived.Gender == "Male" ? true : false);
|
_notifyAnimator.SetBool("Male", UdpSocket.Instance.DataReceived.Gender < 0.5 ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WarningTimerAnimation()
|
private void WarningTimerAnimation()
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace GadGame.State.MainFlowState
|
||||||
public override void Update(float time)
|
public override void Update(float time)
|
||||||
{
|
{
|
||||||
Runner.EncodeImage.Raise(UdpSocket.Instance.DataReceived.StreamingData);
|
Runner.EncodeImage.Raise(UdpSocket.Instance.DataReceived.StreamingData);
|
||||||
if(_scanSuccess || time >= 30)
|
if(_scanSuccess || time >= 60)
|
||||||
{
|
{
|
||||||
Runner.SetState<IdleState>();
|
Runner.SetState<IdleState>();
|
||||||
UdpSocket.Instance.SendDataToPython("End");
|
UdpSocket.Instance.SendDataToPython("End");
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace GadGame.State.MainFlowState
|
||||||
|
|
||||||
public override async void Enter()
|
public override async void Enter()
|
||||||
{
|
{
|
||||||
if(UdpSocket.Instance.DataReceived.Gender == "Male")
|
if(UdpSocket.Instance.DataReceived.Gender < 0.5f)
|
||||||
{
|
{
|
||||||
await LoadSceneManager.Instance.LoadSceneWithTransitionAsync(Runner.SceneFlowConfig.GameMaleScene.ScenePath);
|
await LoadSceneManager.Instance.LoadSceneWithTransitionAsync(Runner.SceneFlowConfig.GameMaleScene.ScenePath);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7a39ff148e30fb9d58f06296c089472b
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 32 MiB |
|
@ -1,140 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 6effafeec1f9b099cb24bd4a39fbd3ae
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 12
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 0
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
flipGreenChannel: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
ignoreMipmapLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 1
|
|
||||||
wrapV: 1
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 0
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 1
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 1
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 8
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
swizzle: 50462976
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Android
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Server
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID: 5e97eb03825dee720800000000000000
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
nameFileIdTable: {}
|
|
||||||
mipmapLimitGroupName:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 1.3 MiB |
|
@ -1,140 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: df86103defef73616a09788628b714f6
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 12
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
flipGreenChannel: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
ignoreMipmapLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 0
|
|
||||||
wrapV: 0
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 0
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
swizzle: 50462976
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Android
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Server
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
nameFileIdTable: {}
|
|
||||||
mipmapLimitGroupName:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 10 MiB |
|
@ -1,140 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 710bfd7bc1866be1c8dc4ea49f23d1e2
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 12
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
flipGreenChannel: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
ignoreMipmapLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 1
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 0
|
|
||||||
wrapV: 0
|
|
||||||
wrapW: 0
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 0
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
swizzle: 50462976
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Android
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
buildTarget: Server
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
nameFileIdTable: {}
|
|
||||||
mipmapLimitGroupName:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 3610228a854abe74ab38a7c727d0df9d
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,30 +0,0 @@
|
||||||
from keras.models import load_model
|
|
||||||
import numpy as np
|
|
||||||
import cv2
|
|
||||||
|
|
||||||
|
|
||||||
class GenderPrediction:
|
|
||||||
def __init__(self):
|
|
||||||
self.model = load_model("gender_v1.0.h5")
|
|
||||||
|
|
||||||
def predict_gender(self, image):
|
|
||||||
|
|
||||||
# chuyển ảnh về mức xám
|
|
||||||
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
|
||||||
|
|
||||||
# resize ảnh phủ hợp với model
|
|
||||||
target_size = (48, 48)
|
|
||||||
resized_face = cv2.resize(gray, target_size)
|
|
||||||
|
|
||||||
# normalize ảnh
|
|
||||||
normalize_face = resized_face / 255.0
|
|
||||||
|
|
||||||
# chuyển về cùng shape với input tensror (1,48,48)
|
|
||||||
normalize_face = np.expand_dims(normalize_face, axis=0)
|
|
||||||
|
|
||||||
# model output 'probabilities': array([[0.019824,0.98018]], dtype=float32)
|
|
||||||
predictions = self.model.predict(normalize_face)
|
|
||||||
threshold = 0.5
|
|
||||||
predicted_class = 'Male' if predictions[0][1] >= threshold else 'Female'
|
|
||||||
|
|
||||||
return predicted_class
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a807882ea4d59856dbaaa432a076bac6
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1 +0,0 @@
|
||||||
from .GenderPredictionModule import GenderPrediction
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7362c6166278fbb78beb273d97fa5d2e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 9b879ed34510c6894b0ae587bb4a4d50
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7601fd4a1e90f48ad9f406bbee74a548
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8083e837c81f01b8a9fb2c605c23396a
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -46,9 +46,9 @@ class FaceDetection:
|
||||||
|
|
||||||
# Check if distances exceed threshold
|
# Check if distances exceed threshold
|
||||||
if not (distance_left > K_MULTIPLIER * distance_right or distance_right > K_MULTIPLIER * distance_left or
|
if not (distance_left > K_MULTIPLIER * distance_right or distance_right > K_MULTIPLIER * distance_left or
|
||||||
self.calculate_dis_to_cp(cx, cy, face_cx, face_cy) > 65):
|
self.calculate_dis_to_cp(cx, cy, face_cx, face_cy) > 50):
|
||||||
return True, True, [x1 - 20, y1 - 20, x2 + 20, y2 + 20]
|
return True, True, [x1 - 20, y1 - 20, x2 + 20, y2 + 20]
|
||||||
|
|
||||||
return True, False, []
|
return True, False, []
|
||||||
|
|
||||||
return False, False, []
|
return False, False
|
||||||
|
|
|
@ -28,11 +28,6 @@ class MainProgram:
|
||||||
per_class=False
|
per_class=False
|
||||||
)
|
)
|
||||||
|
|
||||||
self.face_detect = FaceAnalysis(name='buffalo_l')
|
|
||||||
self.face_detect.prepare(ctx_id=0, det_size=(640, 640))
|
|
||||||
|
|
||||||
self.swapper = insightface.model_zoo.get_model("inswapper_128.onnx")
|
|
||||||
|
|
||||||
self.send_data_unity: dict = {
|
self.send_data_unity: dict = {
|
||||||
"PassBy": False,
|
"PassBy": False,
|
||||||
"Engage": False,
|
"Engage": False,
|
||||||
|
@ -76,9 +71,7 @@ class MainProgram:
|
||||||
|
|
||||||
self.forward_face = FaceDetection()
|
self.forward_face = FaceDetection()
|
||||||
|
|
||||||
# self.face_swap = Face_Swap.FaceSwap()
|
self.face_swap = Face_Swap.FaceSwap()
|
||||||
|
|
||||||
self.gender_model = Gender_Prediction.GenderPrediction()
|
|
||||||
|
|
||||||
self.focus_face_bbox = []
|
self.focus_face_bbox = []
|
||||||
|
|
||||||
|
@ -98,56 +91,72 @@ class MainProgram:
|
||||||
|
|
||||||
return image_url, des
|
return image_url, des
|
||||||
|
|
||||||
def face_swap(self, image, source_face, paste_back=True):
|
def generate_image(self):
|
||||||
"""
|
image_url, des = self.get_image()
|
||||||
Args:
|
|
||||||
image : original content image
|
|
||||||
target: face in the original image [{....}] need embedding
|
|
||||||
source_face: face of the user [{....}] need embedding
|
|
||||||
Return:
|
|
||||||
image with swapped face
|
|
||||||
"""
|
|
||||||
target = self.face_detect.get(image)[0]
|
|
||||||
source_face = self.face_detect.get(source_face)[0]
|
|
||||||
|
|
||||||
res = image.copy()
|
|
||||||
res = self.swapper.get(res, target, source_face, paste_back)
|
|
||||||
return res
|
|
||||||
|
|
||||||
def generate_local_image(self, source_face):
|
|
||||||
# image_url, des = self.get_image()
|
|
||||||
|
|
||||||
# Path to the folder containing images
|
|
||||||
folder_path = "./origin_image/"
|
|
||||||
|
|
||||||
# Get a list of all files in the folder
|
|
||||||
files = os.listdir(folder_path)
|
|
||||||
|
|
||||||
# Filter out only image files (assuming common image formats)
|
|
||||||
image_files = [f for f in files if f.endswith(('.png', '.jpg', '.jpeg', '.bmp', '.gif'))]
|
|
||||||
|
|
||||||
# Check if there are any image files in the folder
|
|
||||||
if image_files:
|
|
||||||
# Select a random image file
|
|
||||||
random_image_file = random.choice(image_files)
|
|
||||||
|
|
||||||
# Read the image using OpenCV
|
|
||||||
image_path = os.path.join(folder_path, random_image_file)
|
|
||||||
image = cv2.imread(image_path)
|
|
||||||
|
|
||||||
origin_image = image.copy()
|
|
||||||
image_path = "./image/merge_face.png"
|
image_path = "./image/merge_face.png"
|
||||||
|
|
||||||
result = self.face_swap(origin_image, source_face)
|
res = self.client.merge_face(
|
||||||
|
image=image_url,
|
||||||
|
face_image="./image/output.jpg",
|
||||||
|
)
|
||||||
|
|
||||||
cv2.imwrite(image_path, result)
|
base64_to_image(res.image_file).save(image_path)
|
||||||
|
|
||||||
|
# Get the current time
|
||||||
|
current_time = datetime.now()
|
||||||
|
|
||||||
|
# Format the current time
|
||||||
|
formatted_time = current_time.strftime("%d_%m_%Y_%H_%M_%S")
|
||||||
|
|
||||||
|
self.des_file = f"sid/{formatted_time}.jpg"
|
||||||
|
|
||||||
|
self.send_data_unity["FileName"] = f"{formatted_time}.jpg"
|
||||||
|
|
||||||
|
self.client_minio.fput_object(
|
||||||
|
self.bucket_name, self.des_file, image_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.send_data_unity["Description"] = des
|
||||||
|
self.send_data_unity["GenerateImageSuccess"] = True
|
||||||
|
self.send_data_unity["StreamingData"] = "./Assets/StreamingAssets/MergeFace/image/merge_face.png"
|
||||||
|
|
||||||
|
def generate_with_rapapi(self):
|
||||||
|
image_url, des = self.get_image()
|
||||||
|
image_path = self.face_swap.save_image_result(image_url)
|
||||||
|
|
||||||
|
# Get the current time
|
||||||
|
current_time = datetime.now()
|
||||||
|
|
||||||
|
# Format the current time
|
||||||
|
formatted_time = current_time.strftime("%d_%m_%Y_%H_%M_%S")
|
||||||
|
|
||||||
|
self.des_file = f"sid/{formatted_time}.jpg"
|
||||||
|
|
||||||
|
self.send_data_unity["FileName"] = f"{formatted_time}.jpg"
|
||||||
|
|
||||||
|
self.client_minio.fput_object(
|
||||||
|
self.bucket_name, self.des_file, image_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.send_data_unity["Description"] = des
|
||||||
|
self.send_data_unity["GenerateImageSuccess"] = True
|
||||||
|
self.send_data_unity["StreamingData"] = "./Assets/StreamingAssets/MergeFace/image/merge_face.jpg"
|
||||||
|
|
||||||
def predict_age_and_gender(self):
|
def predict_age_and_gender(self):
|
||||||
image_predict = cv2.imread("./image/output.jpg")
|
image_predict = cv2.imread("./image/output.jpg")
|
||||||
|
|
||||||
gender = self.gender_model.predict_gender(image_predict)
|
if AgeGenderPrediction.Prediction(image_predict):
|
||||||
|
|
||||||
self.send_data_unity["Gender"] = gender
|
self.send_data_unity["Gender"] = AgeGenderPrediction.Prediction(image_predict)[0]
|
||||||
|
self.send_data_unity["AgeMin"] = int(
|
||||||
|
AgeGenderPrediction.Prediction(image_predict)[1].split("-")[0])
|
||||||
|
self.send_data_unity["AgeMax"] = int(
|
||||||
|
AgeGenderPrediction.Prediction(image_predict)[1].split("-")[1])
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.send_data_unity["Gender"] = None
|
||||||
|
self.send_data_unity["AgeMin"] = None
|
||||||
|
self.send_data_unity["AgeMax"] = None
|
||||||
|
|
||||||
def get_face_bbox(self, frame):
|
def get_face_bbox(self, frame):
|
||||||
outs = self.face_model(frame)
|
outs = self.face_model(frame)
|
||||||
|
@ -180,7 +189,7 @@ class MainProgram:
|
||||||
self.send_data_unity["GenerateImageSuccess"] = False
|
self.send_data_unity["GenerateImageSuccess"] = False
|
||||||
self.send_data_unity["Description"] = ""
|
self.send_data_unity["Description"] = ""
|
||||||
|
|
||||||
if self.ready_success and (not self.check_save):
|
if self.ready_success:
|
||||||
# Perform person detection
|
# Perform person detection
|
||||||
self.send_data_unity["PassBy"], _, _ = self.check_ready(frame)
|
self.send_data_unity["PassBy"], _, _ = self.check_ready(frame)
|
||||||
self.send_data_unity["Engage"] = self.send_data_unity["PassBy"]
|
self.send_data_unity["Engage"] = self.send_data_unity["PassBy"]
|
||||||
|
@ -189,7 +198,7 @@ class MainProgram:
|
||||||
self.send_data_unity["PassBy"], self.send_data_unity["Ready"], self.focus_face_bbox = self.check_ready(frame)
|
self.send_data_unity["PassBy"], self.send_data_unity["Ready"], self.focus_face_bbox = self.check_ready(frame)
|
||||||
self.send_data_unity["Engage"] = self.send_data_unity["PassBy"]
|
self.send_data_unity["Engage"] = self.send_data_unity["PassBy"]
|
||||||
|
|
||||||
elif not self.check_save and self.focus_face_bbox:
|
elif not self.check_save:
|
||||||
cv2.imwrite("./image/output.jpg", self.cropped_image(frame, self.focus_face_bbox[0],
|
cv2.imwrite("./image/output.jpg", self.cropped_image(frame, self.focus_face_bbox[0],
|
||||||
self.focus_face_bbox[1],
|
self.focus_face_bbox[1],
|
||||||
self.focus_face_bbox[2],
|
self.focus_face_bbox[2],
|
||||||
|
@ -206,8 +215,7 @@ class MainProgram:
|
||||||
self.predict_age_and_gender()
|
self.predict_age_and_gender()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
source_face = cv2.imread("./image/output.jpg")
|
self.generate_image()
|
||||||
self.generate_local_image(source_face)
|
|
||||||
self.check_generate = True
|
self.check_generate = True
|
||||||
|
|
||||||
elif self.show_success:
|
elif self.show_success:
|
||||||
|
@ -244,7 +252,7 @@ class MainProgram:
|
||||||
frame_to_handle = frame.copy()
|
frame_to_handle = frame.copy()
|
||||||
self.frame_to_show = frame.copy()
|
self.frame_to_show = frame.copy()
|
||||||
|
|
||||||
# self.person_process(frame_to_handle)
|
self.person_process(frame_to_handle)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.person_process(frame_to_handle)
|
self.person_process(frame_to_handle)
|
||||||
|
|
Before Width: | Height: | Size: 141 KiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d5328b40e18798d11a00149db880fc88
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 75da87cba91cd9b3292f44321a11316d
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 445 KiB After Width: | Height: | Size: 467 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: be7f095ea3440b1f4955e741e19b1c4f
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -41,15 +41,3 @@ from minio.error import S3Error
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import Face_Swap
|
import Face_Swap
|
||||||
|
|
||||||
import Gender_Prediction
|
|
||||||
|
|
||||||
import glob
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import time
|
|
||||||
|
|
||||||
import insightface
|
|
||||||
from insightface.app import FaceAnalysis
|
|
||||||
from insightface.data import get_image as ins_get_image
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d9b041d459c38ce49999bd2bf8b16d58
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.1 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: b40a3786445105766ad5b290fe5341c3
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.5 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: edbb099cd9d6d8e2787cc1d760e3a30e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.3 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 497283cab065c99e08093227c8a58d34
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.1 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 4e1d1be2736f6952597cd5b4808f0dac
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.2 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 74e2e4a677a4bf8f2995d3d55caf0601
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.3 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 892d74b05798dc92796b98e9191c8298
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Before Width: | Height: | Size: 4.1 MiB |
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e311eccb3f1ad09fb8b85ea2f03ee05e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,20 +1,66 @@
|
||||||
import requests
|
import requests
|
||||||
import os
|
import base64
|
||||||
|
|
||||||
image_url = "https://i.ibb.co/8Xw8Yhs/4c91e57ac0340d5eaf137cfc48ecb8bc-1557153402.jpg"
|
|
||||||
|
|
||||||
file_name = "downloaded_image.jpg"
|
def download_image_from_url(url, output_file_path):
|
||||||
|
"""
|
||||||
|
Downloads an image from a URL and saves it to a local file.
|
||||||
|
|
||||||
# Check if the file already exists
|
:param url: The URL of the image to download.
|
||||||
if not os.path.exists(file_name):
|
:param output_file_path: The path where the downloaded image will be saved.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
# Send a GET request to the URL
|
# Send a GET request to the URL
|
||||||
response = requests.get(image_url)
|
image_response = requests.get(url)
|
||||||
|
|
||||||
# Open a local file with write-binary mode
|
# Check if the request was successful
|
||||||
with open(file_name, "wb") as file:
|
if response.status_code == 200:
|
||||||
# Write the contents of the response to the file
|
# Save the image data to a file
|
||||||
file.write(response.content)
|
with open(output_file_path, "wb") as image_file:
|
||||||
|
image_file.write(image_response.content)
|
||||||
print(f"Image downloaded and saved as {file_name}")
|
print(f"Image saved as {output_file_path}")
|
||||||
else:
|
else:
|
||||||
print(f"{file_name} already exists.")
|
print(f"Failed to download image. HTTP status code: {image_response.status_code}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
swap_url = "https://faceswap3.p.rapidapi.com/faceswap/v1/image"
|
||||||
|
|
||||||
|
payload = ("-----011000010111000001101001\r\nContent-Disposition: form-data; "
|
||||||
|
"name=\"target_url\"\r\n\r\nhttps://i.ibb.co/kh2XYLh/vnpdtvnvsu22vn-27122020-x-108-jpg.jpg\r\n"
|
||||||
|
"-----011000010111000001101001\r\nContent-Disposition: form-data; "
|
||||||
|
"name=\"swap_url\"\r\n\r\nhttps://storage.gadgame.com/play4promo/sid/final_image.jpg\r\n"
|
||||||
|
"-----011000010111000001101001--\r\n\r\n")
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"x-rapidapi-key": "34c3c2de43msh9d754fc788c3d36p15c896jsn8796ea559bce",
|
||||||
|
"x-rapidapi-host": "faceswap3.p.rapidapi.com",
|
||||||
|
"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(swap_url, data=payload, headers=headers)
|
||||||
|
|
||||||
|
result = response.json()
|
||||||
|
|
||||||
|
request_id = result["image_process_response"]["request_id"]
|
||||||
|
|
||||||
|
result_url = "https://faceswap3.p.rapidapi.com/result/"
|
||||||
|
|
||||||
|
payload = ("-----011000010111000001101001\r\nContent-Disposition: form-data; "
|
||||||
|
f"name=\"request_id\"\r\n\r\n{request_id}\r\n-----011000010111000001101001--\r\n\r\n")
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"x-rapidapi-key": "34c3c2de43msh9d754fc788c3d36p15c896jsn8796ea559bce",
|
||||||
|
"x-rapidapi-host": "faceswap3.p.rapidapi.com",
|
||||||
|
"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(result_url, data=payload, headers=headers)
|
||||||
|
|
||||||
|
url_image = response.json()["image_process_response"]["result_url"]
|
||||||
|
|
||||||
|
print(url_image)
|
||||||
|
|
||||||
|
download_image_from_url(url_image, "rapapi.jpg")
|
||||||
|
|