Can you zoom into the falling edge? Since the signal is going down very slow, I'd be surprised if you don't see multiple transitions if you look closely. This would generate the same counting issues as you see with the interrupt based code.
Anyway, you can try this:
Code:
#include "Arduino.h"
constexpr int sensor = 23;
constexpr int cameraTrigger = 32;
void setup()
{
pinMode(sensor, INPUT_PULLDOWN);
pinMode(cameraTrigger, OUTPUT);
analogWriteFrequency(0, 96);
analogWrite(0, 128);
}
unsigned cnt = 0;
unsigned oldVal = LOW;
void loop()
{
unsigned val = digitalRead(sensor);
if (val != oldVal)
{
if (val == HIGH) // rising edge
{
cnt++;
if (cnt >= 4)
{
digitalWrite(cameraTrigger, HIGH);
cnt = 0;
delayMicroseconds(500);
}
}
else // falling edge
{
digitalWrite(cameraTrigger, LOW);
delayMicroseconds(500);
}
oldVal = val;
}
}

I changed the pin mode to INPUT_PULLDOWN to activate the Schmitt trigger on the pin which should help reducing multiple transitions. I also added a delay after detection of a signal edge which might also help. You can increase the time if necessary.
And: did I mention already that voltage regulators are not meant to be used for level shifting?